0001-hobo-deploy-handle-maintenance-related-variables-654.patch
tests/test_hobo.py | ||
---|---|---|
205 | 205 |
'theme': 'clapotis-les-canards', |
206 | 206 |
'sms_url': 'http://passerelle.example.net', |
207 | 207 |
'sms_sender': 'EO', |
208 |
'SETTING_TENANT_DISABLE_CRON_JOBS': True, |
|
209 |
'SETTING_MAINTENANCE_PAGE': True, |
|
210 |
'SETTING_MAINTENANCE_PAGE_MESSAGE': 'foo', |
|
211 |
'SETTING_MAINTENANCE_PASS_THROUGH_HEADER': 'X-bar', |
|
208 | 212 |
}, |
209 | 213 |
'users': [ |
210 | 214 |
{ |
... | ... | |
243 | 247 |
assert pub.get_site_option('portal_agent_url', 'variables') == 'http://agents.example.net/' |
244 | 248 |
assert pub.get_site_option('portal_url', 'variables') == 'http://portal.example.net/' |
245 | 249 |
assert pub.get_site_option('test_wcs_url', 'variables') == 'http://wcs.example.net/' |
250 |
assert pub.get_site_option('disable_cron_jobs', 'variables') == 'True' |
|
251 |
assert pub.get_site_option('maintenance_page', 'variables') == 'True' |
|
252 |
assert pub.get_site_option('maintenance_page_message', 'variables') == 'foo' |
|
253 |
assert pub.get_site_option('maintenance_pass_through_header', 'variables') == 'X-bar' |
|
254 | ||
246 | 255 |
key = '109fca71e7dc8ec49708a08fa7c02795de13f34f7d29d27bd150f203b3e0ab40' |
247 | 256 |
assert pub.get_site_option('authentic.example.net', 'api-secrets') == key |
248 | 257 |
assert pub.get_site_option('authentic.example.net', 'wscall-secrets') == key |
wcs/ctl/check_hobos.py | ||
---|---|---|
422 | 422 |
instance_path += '+%s' % parsed_url.path.replace('/', '+') |
423 | 423 |
return instance_path |
424 | 424 | |
425 |
def handle_maintenance_variables(self, name, value): |
|
426 |
match = False |
|
427 |
if name == 'SETTING_TENANT_DISABLE_CRON_JOBS': |
|
428 |
name = 'disable_cron_jobs' |
|
429 |
match = True |
|
430 |
if name.startswith('SETTING_MAINTENANCE'): |
|
431 |
name = name[8:] |
|
432 |
match = True |
|
433 |
if match and not value: |
|
434 |
value = None |
|
435 |
return name, value |
|
436 | ||
425 | 437 |
def configure_site_options(self, current_service, pub, ignore_timestamp=False): |
426 | 438 |
# configure site-options.cfg |
427 | 439 |
config = configparser.RawConfigParser() |
... | ... | |
498 | 510 | |
499 | 511 |
if self.all_services.get('variables'): |
500 | 512 |
for key, value in self.all_services.get('variables').items(): |
513 |
key, value = self.handle_maintenance_variables(key, value) |
|
501 | 514 |
variables[key] = value |
502 | 515 |
for key, value in current_service.get('variables', {}).items(): |
503 | 516 |
variables[key] = value |
504 |
- |