Merge "Update cert-mon dc token cache post network config"
This commit is contained in:
commit
ea35e59693
|
@ -428,6 +428,14 @@ class CertificateMonManager(periodic_task.PeriodicTasks):
|
|||
subcloud_audit_queue.SubcloudAuditData(subcloud_name),
|
||||
allow_requeue=allow_requeue)
|
||||
|
||||
def subcloud_sysinv_endpoint_update(self, subcloud_name, sysinv_url):
|
||||
dc_token = self.dc_token_cache.get_token()
|
||||
subcloud_sysinv_url = utils.dc_get_subcloud_sysinv_url(
|
||||
subcloud_name, dc_token)
|
||||
if subcloud_sysinv_url != sysinv_url:
|
||||
utils.dc_update_subcloud_sysinv_url(
|
||||
subcloud_name, sysinv_url, dc_token)
|
||||
|
||||
def monitor_cert(self, monitor):
|
||||
while True:
|
||||
# never exit until exit signal received
|
||||
|
|
|
@ -120,3 +120,8 @@ class CertificateMonitorService(service.Service):
|
|||
LOG.info("%s is managed. An audit is queued"
|
||||
% subcloud_name)
|
||||
self.manager.audit_subcloud(subcloud_name)
|
||||
|
||||
def subcloud_sysinv_endpoint_update(self, ctxt, subcloud_name, endpoint):
|
||||
"""Update sysinv endpoint of dc token cache"""
|
||||
LOG.info("Update subloud: %s sysinv endpoint" % subcloud_name)
|
||||
self.manager.subcloud_sysinv_endpoint_update(subcloud_name, endpoint)
|
||||
|
|
|
@ -152,6 +152,13 @@ def dc_get_subcloud_sysinv_url(subcloud_name, dc_token):
|
|||
raise Exception('Cannot find sysinv endpoint for %s' % subcloud_name)
|
||||
|
||||
|
||||
def dc_update_subcloud_sysinv_url(subcloud_name, sysinv_url, dc_token):
|
||||
dc_token.update_service_admin_url(constants.SERVICE_TYPE_PLATFORM,
|
||||
constants.SYSINV_USERNAME,
|
||||
subcloud_name,
|
||||
sysinv_url)
|
||||
|
||||
|
||||
def dc_get_service_endpoint_url(token,
|
||||
service_name='dcmanager',
|
||||
service_type='dcmanager',
|
||||
|
|
|
@ -81,6 +81,26 @@ class Token(object):
|
|||
return self._get_service_url(service_type, service_name, 'admin',
|
||||
region_name)
|
||||
|
||||
def update_service_admin_url(
|
||||
self, service_type, service_name, region_name, endpoint):
|
||||
"""Update the catalog of a service for the administrative url"""
|
||||
return self._set_service_url(service_type, service_name,
|
||||
'admin', region_name, endpoint)
|
||||
|
||||
def _set_service_url(self, service_type, service_name, interface_type,
|
||||
region_name, new_endpoint):
|
||||
"""Update the url of a service in a region"""
|
||||
if region_name is None:
|
||||
region_name = self.region_name
|
||||
for catalog in self.data['token']['catalog']:
|
||||
if (catalog['type'] == service_type and
|
||||
catalog['name'] == service_name and
|
||||
catalog['endpoints']):
|
||||
for endpoint in catalog['endpoints']:
|
||||
if (endpoint['interface'] == interface_type
|
||||
and endpoint['region'] == region_name):
|
||||
endpoint['url'] = new_endpoint
|
||||
|
||||
def get_service_internal_url(self,
|
||||
service_type,
|
||||
service_name,
|
||||
|
|
Loading…
Reference in New Issue