check_hobos: add --redeploy option (#8894)

This commit is contained in:
Benjamin Dauvergne 2015-12-18 23:15:19 +01:00
parent cdd412648b
commit 0257dee49f
1 changed files with 20 additions and 0 deletions

View File

@ -42,9 +42,29 @@ class CmdCheckHobos(Command):
Command.__init__(self, [
make_option('--ignore-timestamp', action='store_true',
dest='ignore_timestamp', default=False),
make_option('--redeploy', action='store_true', default=False),
])
def execute(self, base_options, sub_options, args):
if sub_options.redeploy:
sub_options.ignore_timestamp = True
for tenant in os.listdir(WcsPublisher.APP_DIR):
if tenant.endswith('.invalid'):
continue
hobo_json_path = os.path.join(tenant, 'hobo.json')
if not os.path.exists(hobo_json_path):
continue
hobo_json = json.load(open(hobo_json_path))
try:
me = [service for service in hobo_json['services'] if service['this'] is True][0]
except IndexError:
pass
else:
self.deploy(base_options, sub_options, [me['base_url'], hobo_json_path])
else:
self.deploy(base_options, sub_options, args)
def deploy(self, base_options, sub_options, args):
import publisher
self.base_options = base_options