Projet

Général

Profil

0001-check_hobos-add-redeploy-option-8894.patch

Benjamin Dauvergne, 06 janvier 2016 10:15

Télécharger (1,76 ko)

Voir les différences:

Subject: [PATCH 1/2] check_hobos: add --redeploy option (#8894)

 wcs/ctl/check_hobos.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
wcs/ctl/check_hobos.py
42 42
        Command.__init__(self, [
43 43
                make_option('--ignore-timestamp', action='store_true',
44 44
                            dest='ignore_timestamp', default=False),
45
                make_option('--redeploy', action='store_true', default=False),
45 46
                ])
46 47

  
47 48
    def execute(self, base_options, sub_options, args):
49
        if sub_options.redeploy:
50
            sub_options.ignore_timestamp = True
51
            for tenant in os.listdir(WcsPublisher.APP_DIR):
52
                if tenant.endswith('.invalid'):
53
                    continue
54
                hobo_json_path = os.path.join(tenant, 'hobo.json')
55
                if not os.path.exists(hobo_json_path):
56
                    continue
57
                hobo_json = json.load(open(hobo_json_path))
58
                try:
59
                    me = [service for service in hobo_json['services'] if service['this'] is True][0]
60
                except IndexError:
61
                    pass
62
                else:
63
                    self.deploy(base_options, sub_options, [me['base_url'], hobo_json_path])
64
        else:
65
            self.deploy(base_options, sub_options, args)
66

  
67
    def deploy(self, base_options, sub_options, args):
48 68
        import publisher
49 69

  
50 70
        self.base_options = base_options
51
-