From f2f5f39508819faabe6684307d3b74908776d563 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 18 Dec 2015 23:15:19 +0100 Subject: [PATCH 1/2] check_hobos: add --redeploy option (#8894) --- wcs/ctl/check_hobos.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wcs/ctl/check_hobos.py b/wcs/ctl/check_hobos.py index d2d8119..a02fe30 100644 --- a/wcs/ctl/check_hobos.py +++ b/wcs/ctl/check_hobos.py @@ -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 -- 2.1.4