0001-check_hobos-handle-base_url-with-ou-without-trailing.patch
wcs/ctl/check_hobos.py | ||
---|---|---|
93 | 93 |
register_tld_names=False) |
94 | 94 | |
95 | 95 |
global_app_dir = pub.app_dir |
96 | ||
96 | 97 |
base_url = args[0] |
98 |
if base_url.endswith('/'): # wcs doesn't expect a trailing slash |
|
99 |
base_url = base_url[:-1] |
|
97 | 100 | |
98 | 101 |
if args[1] == '-': |
99 | 102 |
# get environment definition from stdin |
... | ... | |
101 | 104 |
else: |
102 | 105 |
self.all_services = json.load(file(args[1])) |
103 | 106 | |
104 |
try: |
|
105 |
service = [x for x in self.all_services.get('services', []) if \ |
|
106 |
x.get('service-id') == 'wcs' and x.get('base_url') == base_url and |
|
107 |
not x.get('secondary')][0] |
|
108 |
except IndexError: |
|
107 |
for service in self.all_services.get('services', []): |
|
108 |
if service.get('service-id') != 'wcs': |
|
109 |
continue |
|
110 |
if service.get('secondary'): |
|
111 |
continue |
|
112 |
if not service.get('base_url'): |
|
113 |
continue |
|
114 |
if service['base_url'] == base_url or service['base_url'] == base_url + '/': |
|
115 |
break |
|
116 |
else: |
|
109 | 117 |
return |
110 | 118 | |
111 | 119 |
service['this'] = True |
112 |
if base_url.endswith('/'): # wcs doesn't expect a trailing slash |
|
113 |
service['base_url'] = base_url[:-1] |
|
120 |
service['base_url'] = base_url # remove potential trailing slash |
|
114 | 121 | |
115 | 122 |
pub.app_dir = os.path.join(global_app_dir, |
116 | 123 |
self.get_instance_path(service)) |
117 |
- |