Skip to content

Commit

Permalink
Multi: -opt:index (-c:1) now always refers to the index of a node in …
Browse files Browse the repository at this point in the history
…the argument list.
  • Loading branch information
ask committed Feb 18, 2014
1 parent c403d0b commit a22dc23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions celery/bin/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,18 @@ def multi_args(p, cmd='celery worker', append='', prefix='', suffix=''):
p.namespaces[subns].update(ns_opts)
p.namespaces.pop(ns_name)

# Numbers in args always refers to the index in the list of names.
# (e.g. `start foo bar baz -c:1` where 1 is foo, 2 is bar, and so on).
for ns_name, ns_opts in list(items(p.namespaces)):
if ns_name.isdigit():
ns_index = int(ns_name) - 1
if ns_index < 0:
raise KeyError('Indexes start at 1 got: %r' % (ns_name, ))
try:
p.namespaces[names[ns_index]].update(ns_opts)
except IndexError:
raise KeyError('No node at index %r' % (ns_name, ))

for name in names:
this_suffix = suffix
if '@' in name:
Expand Down

0 comments on commit a22dc23

Please sign in to comment.