Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2f93a9

Browse files
committed
Allow specifying multiple classes at the same time
This was previously possible by doing: ``` fab production class:cache class:bouncer do:uptime ``` But that would run the `class` task for bouncer on each of the cache machines (which is not a problem, just noisy). This commit changes the parameter to the `class` task so that multiple arguments can be passed in.
1 parent a3ea589 commit b2f93a9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ And execute against an environment and set of hosts like so:
3535
$ fab preview all hosts
3636
...
3737
$ fab preview class:frontend do:'uname -a'
38+
$ fab preview class:cache,bouncer do:uptime
3839
...
3940

4041
### Targetting groups of machines

fabfile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,10 @@ def numbered(number):
263263
env.hosts = [host for host in env.hosts if re.search((r'-%s\.' % number), host)]
264264

265265
@task(name='class')
266-
def klass(class_name):
266+
def klass(*class_names):
267267
"""Select a machine class"""
268-
env.hosts.extend(env.roledefs['class-%s' % class_name]())
268+
for class_name in class_names:
269+
env.hosts.extend(env.roledefs['class-%s' % class_name]())
269270

270271
@task
271272
@serial

0 commit comments

Comments
 (0)