fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] How to pass parameters to new-style tasks when using fabric.a


From: Stephen Nesbitt
Subject: [Fab-user] How to pass parameters to new-style tasks when using fabric.api.execute?
Date: Mon, 10 Dec 2012 10:12:19 -0800
User-agent: KMail/4.9.3 (Linux/3.5.0-19-generic; KDE/4.9.3; x86_64; ; )

All:

What is the correct way to define a new-style task with parameters that can be 
called via the execute command.

I've tried the following, but I get an error indicating that the hello task 
doesn't take any parameters.

#! /var/lib/python-envs/sysadmin_env/bin/python
from fabric.api import env, execute, task

@task(param1, param2)
def hello():
    print("Hello world! param1 = %s, param2 = %s" % (param1, param2))

if __name__=="__main__":
  execute(hello, param1="param1", param2="param2")


Thanks in advance,

-steve



reply via email to

[Prev in Thread] Current Thread [Next in Thread]