0001-check_hobos-store-legacy-urls-61857.patch
tests/test_hobo.py | ||
---|---|---|
63 | 63 |
'title': 'Portal', |
64 | 64 |
'base_url': 'http://portal.example.net/', |
65 | 65 |
'secret_key': 'bbb', |
66 |
'legacy_urls': [ |
|
67 |
{ |
|
68 |
'base_url': 'http://oldportal.example.net/', |
|
69 |
}, |
|
70 |
{ |
|
71 |
'base_url': 'http://veryoldportal.example.net/', |
|
72 |
}, |
|
73 |
], |
|
66 | 74 |
}, |
67 | 75 |
], |
68 | 76 |
'profile': { |
... | ... | |
240 | 248 |
assert pub.get_site_option('authentic.example.net', 'wscall-secrets') == key |
241 | 249 |
self_domain = urllib.parse.urlsplit(service.get('base_url')).netloc |
242 | 250 |
assert pub.get_site_option(self_domain, 'wscall-secrets') != '0' |
251 |
assert ( |
|
252 |
pub.get_site_option('portal.example.net', 'legacy-urls') |
|
253 |
== 'oldportal.example.net,veryoldportal.example.net' |
|
254 |
) |
|
243 | 255 | |
244 | 256 |
service['variables']['xxx'] = None |
245 | 257 |
hobo_cmd.configure_site_options(service, pub, ignore_timestamp=True) |
wcs/ctl/check_hobos.py | ||
---|---|---|
443 | 443 | |
444 | 444 |
variables = {} |
445 | 445 |
api_secrets = {} |
446 |
legacy_urls = {} |
|
446 | 447 |
for service in self.all_services.get('services', []): |
447 | 448 |
service_url = service.get('base_url') |
448 | 449 |
if not service_url.endswith('/'): |
... | ... | |
489 | 490 |
variables['portal_user_url'] = service_url |
490 | 491 |
variables['portal_user_title'] = service.get('title') |
491 | 492 |
config.set('options', 'theme_skeleton_url', service.get('base_url') + '__skeleton__/') |
493 |
if service.get('legacy_urls'): |
|
494 |
legacy_urls_list = [ |
|
495 |
urllib.parse.urlparse(url['base_url']).netloc.split(':')[0] |
|
496 |
for url in service.get('legacy_urls', []) |
|
497 |
] |
|
498 |
legacy_urls[domain] = ','.join(legacy_urls_list) |
|
492 | 499 | |
493 | 500 |
if self.all_services.get('variables'): |
494 | 501 |
for key, value in self.all_services.get('variables').items(): |
... | ... | |
518 | 525 |
# for now the secrets are the same whatever the direction is. |
519 | 526 |
config.set('wscall-secrets', key, value) |
520 | 527 | |
528 |
if 'legacy-urls' not in config.sections() and legacy_urls: |
|
529 |
config.add_section('legacy-urls') |
|
530 |
for key, value in legacy_urls.items(): |
|
531 |
config.set('legacy-urls', key, value) |
|
532 | ||
521 | 533 |
# add known services |
522 | 534 |
for service in self.all_services.get('services', []): |
523 | 535 |
if service.get('secondary'): |
524 |
- |