Create new context for each recreation of ssl cert

This will make tracking cert creation easier
when searching through logs by request_id.

Change-Id: Ic233f537bbbe3762a2e561677f7e24982e5ab904
This commit is contained in:
Isaac Mungai 2016-10-03 10:25:03 -04:00
parent d9ec45d8c2
commit cda9e802b3
3 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from oslo_log import log
from taskflow.patterns import linear_flow
from taskflow import retry
from poppy.distributed_task.taskflow.task import common
from poppy.distributed_task.taskflow.task import create_ssl_certificate_tasks
from poppy.distributed_task.taskflow.task import delete_ssl_certificate_tasks
@ -30,6 +31,8 @@ conf(project='poppy', prog='poppy', args=[])
def recreate_ssl_certificate():
flow = linear_flow.Flow('Recreating poppy ssl certificate').add(
linear_flow.Flow('Update Oslo Context').add(
common.ContextUpdateTask()),
delete_ssl_certificate_tasks.DeleteStorageSSLCertificateTask(),
create_ssl_certificate_tasks.CreateStorageSSLCertificateTask(),
linear_flow.Flow("Provision poppy ssl certificate",

View File

@ -285,6 +285,9 @@ class DefaultSSLCertificateController(base.SSLCertificateController):
'providers_list_json': json.dumps(providers),
'cert_obj_json': json.dumps(cert_obj.to_dict()),
'enqueue': False,
'context_dict': context_utils.RequestContext(
tenant=cert_obj.project_id
).to_dict()
}
self.distributed_task_controller.submit_task(
recreate_ssl_certificate.recreate_ssl_certificate,

View File

@ -1030,6 +1030,7 @@ class TestFlowRuns(base.TestCase):
'domain_name': 'mytestsite.com',
'cert_type': 'san',
'cert_obj_json': json.dumps(cert_obj_json.to_dict()),
'context_dict': context_utils.RequestContext().to_dict()
}
(