Last active
January 2, 2016 19:18
-
-
Save exhuma/8348976 to your computer and use it in GitHub Desktop.
Transcript for comment on http://stackoverflow.com/a/17724207/160665
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌─[10:15:19] michel@PC12-331 | |
└─~/tmp› cat fabfile.py | |
import fabric.api as fab | |
fab.env.roledefs['staging'] = ['bbs-evolution.ipsw.dt.ept.lu'] | |
fab.env.roledefs['prod'] = ['bbs-arbiter.ipsw.dt.ept.lu'] | |
@fab.task | |
def mytask(): | |
print fab.env.roles | |
print fab.run('hostname') | |
┌─[10:15:24] michel@PC12-331 | |
└─~/tmp› fab mytask:roles="staging,prod" | |
[bbs-evolution.ipsw.dt.ept.lu] Executing task 'mytask' | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/fabric/main.py", line 743, in main | |
*args, **kwargs | |
File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 368, in execute | |
multiprocessing | |
File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 264, in _execute | |
return task.run(*args, **kwargs) | |
File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 171, in run | |
return self.wrapped(*args, **kwargs) | |
TypeError: mytask() takes no arguments (1 given) | |
┌─[10:16:26] michel@PC12-331 | |
└─~/tmp› fab mytask -R "staging,prod" | |
[bbs-nexus.ipsw.dt.ept.lu] Executing task 'mytask' | |
['staging', 'prod'] | |
[bbs-nexus.ipsw.dt.ept.lu] run: hostname | |
[bbs-nexus.ipsw.dt.ept.lu] out: BBS-nexus.ipsw.dt.ept.lu | |
[bbs-nexus.ipsw.dt.ept.lu] out: | |
BBS-nexus.ipsw.dt.ept.lu | |
[bbs-pylon.ipsw.dt.ept.lu] Executing task 'mytask' | |
['staging', 'prod'] | |
[bbs-pylon.ipsw.dt.ept.lu] run: hostname | |
[bbs-pylon.ipsw.dt.ept.lu] out: BBS-pylon.ipsw.dt.ept.lu | |
[bbs-pylon.ipsw.dt.ept.lu] out: | |
BBS-pylon.ipsw.dt.ept.lu | |
Done. | |
Disconnecting from bbs-nexus.ipsw.dt.ept.lu... done. | |
Disconnecting from bbs-pylon.ipsw.dt.ept.lu... done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be
fab mytask:roles="staging;prod"
. Use semi-colon, not comma.