For example:
def task(something=''):
print "You said %s" % something
$ fab task "hello"
You said hello
Done.
Fabric:
A library and command line tool for streamlining the use of ssh for application deployment or systems administration
tasks
to automate deployments, migrations, execute management commands, monitoring
no more repetitive maintenance task done manually
- Fabric uses the following syntax for passing arguments to tasks:
-
fab task:'hello world'
fab task:something='hello'
fab task:foo=99,bar=True
fab task:foo,bar
You need to pass all Python variables as strings, especially if you are using sub-process to run the scripts, or you will get an error. You will need to convert the variables back to int/Boolean types separately.
def print_this(var): print str(var) fab print_this:'hello world' fab print_this='hello' fab print_this:'99' fab print_this='True'
No comments:
Post a Comment