Skip to content

Commit

Permalink
Broker option (-b URL) now works with celeryctl, camqadm and celeryev
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Aug 22, 2011
1 parent 06b2a9f commit 9497342
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion celery/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import absolute_import
from __future__ import with_statement

import os
import platform as _platform
import sys

Expand Down Expand Up @@ -122,7 +123,10 @@ def BROKER_BACKEND(self):

@property
def BROKER_HOST(self):
return self.get("BROKER_URL") or self.get("BROKER_HOST")

return (os.environ.get("CELERY_BROKER_URL") or
self.get("BROKER_URL") or
self.get("BROKER_HOST"))


class BaseApp(object):
Expand Down
2 changes: 1 addition & 1 deletion celery/app/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def to_python(self, value):

NAMESPACES = {
"BROKER": {
"URL": Option(os.environ.get("CELERY_BROKER_URL"), type="string"),
"URL": Option(None, type="string"),
"HOST": Option(None, type="string"),
"PORT": Option(type="int"),
"USER": Option(None, type="string"),
Expand Down
13 changes: 13 additions & 0 deletions celery/bin/celeryctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,21 @@ def execute(self, command, argv=None):
except Error:
return self.execute("help", argv)

def remove_options_at_beginning(self, argv, index=0):
while index <= len(argv):
value = argv[index]
if value.startswith("--"):
pass
elif value.startswith("-"):
index += 1
else:
return argv[index:]
index += 1
return []

def handle_argv(self, prog_name, argv):
self.prog_name = prog_name
argv = self.remove_options_at_beginning(argv)
try:
command = argv[0]
except IndexError:
Expand Down

0 comments on commit 9497342

Please sign in to comment.