Question

Here is the full script

from fabric.api import run, env, execute

env.hosts = ['root@host',]

def install():
    run('apt-get install git')
    run('apt-get install mercurial')
    run('apt-get install golang')

def set_GOPATH():
    run('echo "export GOPATH=/usr/lib/gopath" > /root/.bash_profile')
    run('export GOPATH=/usr/lib/gopath')

def go_get():
    run('go get "code.google.com/p/log4go"')

def set_ulimit():
    run('ulimit -n 32000')

def get_code():
    run('git clone https://me@bitbucket.org/me/rr.git')

def compile():
    run('cd rr')
    run('go build -o rr example.go')

def run():    
    run('screen -S rr')
    run('./rr')

def doit():
    install()
    setGOPATH()
    go_get()
    set_ulimit()
    get_code()
    compile()
    run()

fab doit

returns the following error:

run('apt-get install git')
TypeError: run() takes no arguments (1 given)

the same error occurring then running

fab install

. If install function is copied in the separate fabfile with no other functions it is working fine. I don't understand what causes such behavior.

Was it helpful?

Solution

You have override fabric's run with you own:

def run():    
    run('screen -S rr')
    run('./rr')

Give it different name and everything should be fine :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top