0003-misc-update-management-commands-to-new-arg-parsing-2.patch
hobo/agent/authentic2/management/commands/import-wcs-roles.py | ||
---|---|---|
156 | 156 | |
157 | 157 | |
158 | 158 |
class Command(BaseCommand): |
159 |
option_list = BaseCommand.option_list + ( |
|
160 |
make_option('--delete', action='store_true', dest='delete'), |
|
161 |
) |
|
162 | 159 |
help = "Import W.C.S. roles" |
163 | 160 | |
164 | 161 |
requires_system_checks = False |
165 | 162 | |
163 |
def add_arguments(self, parser): |
|
164 |
parser.add_argument('--delete', action="store_true", dest='delete') |
|
165 | ||
166 | 166 |
def handle(self, *args, **options): |
167 | 167 |
# traverse list of tenants |
168 | 168 |
for tenant in TenantMiddleware.get_tenants(): |
hobo/agent/common/management/commands/hobo_deploy.py | ||
---|---|---|
1 | 1 |
import json |
2 |
from optparse import make_option |
|
3 | 2 |
import os |
4 | 3 |
import requests |
5 | 4 |
import subprocess |
... | ... | |
32 | 31 | |
33 | 32 | |
34 | 33 |
class Command(BaseCommand): |
35 |
args = ['base_url', 'json_filename'] |
|
36 | 34 |
early_secondary_exit = True |
37 | 35 |
me = None |
38 | 36 | |
39 |
option_list = BaseCommand.option_list + ( |
|
40 |
make_option('--ignore-timestamp', dest='ignore_timestamp', |
|
41 |
action="store_true", default=False), |
|
42 |
make_option('--redeploy', action="store_true", default=False), |
|
43 |
) |
|
37 |
def add_arguments(self, parser): |
|
38 |
parser.add_argument('base_url', metavar='BASE_URL', type=str) |
|
39 |
parser.add_argument('json_filename', metavar='JSON_FILENAME', type=str) |
|
40 |
parser.add_argument('--ignore-timestamp', dest='ignore_timestamp', |
|
41 |
action="store_true", default=False) |
|
42 |
parser.add_argument('--redeploy', action="store_true", default=False) |
|
44 | 43 | |
45 | 44 |
def handle(self, base_url=None, json_filename=None, ignore_timestamp=None, |
46 | 45 |
redeploy=None, *args, **kwargs): |
hobo/agent/common/management/commands/hobo_notify.py | ||
---|---|---|
34 | 34 |
pass |
35 | 35 | |
36 | 36 |
class Command(BaseCommand): |
37 |
args = ['...'] |
|
37 |
def add_arguments(self, parser): |
|
38 |
parser.add_argument('notification', metavar='NOTIFICATION', type=str) |
|
38 | 39 | |
39 | 40 |
@classmethod |
40 |
def load_notification(cls, args):
|
|
41 |
if args[0] == '-':
|
|
41 |
def load_notification(cls, notification):
|
|
42 |
if notification == '-':
|
|
42 | 43 |
# get environment definition from stdin |
43 | 44 |
return json.load(sys.stdin) |
44 | 45 |
else: |
45 |
return json.load(file(args[0]))
|
|
46 |
return json.load(file(notification))
|
|
46 | 47 | |
47 |
def handle(self, *args, **kwargs):
|
|
48 |
notification = self.load_notification(args)
|
|
48 |
def handle(self, notification, **kwargs):
|
|
49 |
notification = self.load_notification(notification)
|
|
49 | 50 |
for tenant in TenantMiddleware.get_tenants(): |
50 | 51 |
if not os.path.exists(os.path.join(tenant.get_directory(), 'hobo.json')): |
51 | 52 |
continue |
hobo/environment/management/commands/cook.py | ||
---|---|---|
20 | 20 |
import time |
21 | 21 |
import os |
22 | 22 |
import urlparse |
23 |
from optparse import make_option |
|
24 | 23 | |
25 | 24 |
from django.contrib.auth.models import User |
26 | 25 |
from django.contrib.contenttypes.models import ContentType |
... | ... | |
46 | 45 | |
47 | 46 | |
48 | 47 |
class Command(BaseCommand): |
49 |
args = ['...'] |
|
50 | 48 |
must_notify = False |
51 | 49 |
verbosity = 1 |
52 | 50 | |
53 |
option_list = BaseCommand.option_list + ( |
|
54 |
make_option('--timeout', type='int', action='store', default=120, |
|
55 |
help='set the timeout for the wait_operationals method'), |
|
56 |
) |
|
51 |
def add_arguments(self, parser): |
|
52 |
parser.add_argument('recipe', metavar='RECIPE', type=str) |
|
53 |
parser.add_argument( |
|
54 |
'--timeout', type=int, action='store', default=120, |
|
55 |
help='set the timeout for the wait_operationals method') |
|
57 | 56 | |
58 |
def handle(self, recipe_json, *args, **kwargs):
|
|
57 |
def handle(self, recipe, *args, **kwargs): |
|
59 | 58 |
self.verbosity = kwargs.get('verbosity') |
60 | 59 |
self.timeout = kwargs.get('timeout') |
61 |
self.run_cook(recipe_json)
|
|
60 |
self.run_cook(recipe) |
|
62 | 61 |
if self.verbosity: |
63 | 62 |
print 'All steps executed successfully. Your environment should now be ready.' |
64 | 63 | |
65 |
- |