From dc9fb5842cd302ec5e2fb9a68566a0214738badd Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 14 Jun 2018 14:30:30 -0400 Subject: [PATCH] Fix nits from trusted certs notification change This is a follow up to address a few nits in change Ib5b50a3889ab15d5aac992f92e9be372a915eeff. Change-Id: I08ce4a9f5bb33761d8c5ff82ef9faf874ac97fcc --- nova/notifications/objects/instance.py | 6 +++--- ...ed-certs-microversion-589b75f0180d4d51.yaml | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nova/notifications/objects/instance.py b/nova/notifications/objects/instance.py index 30949b3ba24a..3daf864b6849 100644 --- a/nova/notifications/objects/instance.py +++ b/nova/notifications/objects/instance.py @@ -236,7 +236,7 @@ class InstanceCreatePayload(InstanceActionPayload): self.tags = [instance_tag.tag for instance_tag in instance.tags] self.trusted_image_certificates = None - if instance.get("trusted_certs", None): + if instance.trusted_certs: self.trusted_image_certificates = instance.trusted_certs.ids @@ -322,14 +322,14 @@ class InstanceActionRebuildPayload(InstanceActionPayload): nullable=True) } - def __init__(self, context, instance, fault, bdms): + def __init__(self, context, instance, fault, bdms=None): super(InstanceActionRebuildPayload, self).__init__( context=context, instance=instance, fault=fault, bdms=bdms) self.trusted_image_certificates = None - if instance.get("trusted_certs", None): + if instance.trusted_certs: self.trusted_image_certificates = instance.trusted_certs.ids diff --git a/releasenotes/notes/trusted-certs-microversion-589b75f0180d4d51.yaml b/releasenotes/notes/trusted-certs-microversion-589b75f0180d4d51.yaml index f37c539826f6..92dda25b665b 100644 --- a/releasenotes/notes/trusted-certs-microversion-589b75f0180d4d51.yaml +++ b/releasenotes/notes/trusted-certs-microversion-589b75f0180d4d51.yaml @@ -30,17 +30,17 @@ features: * ``POST /servers/{server_id}/action (rebuild)`` The payload of the ``instance.create.start`` and ``instance.create.end`` - and ``instance.create.error`` notifications have been extended with the - ``trusted_image_certificates`` field that contains the list of trusted - certificate IDs used when the instance is created. + and ``instance.create.error`` versioned notifications have been extended + with the ``trusted_image_certificates`` field that contains the list of + trusted certificate IDs used when the instance is created. The payload of the ``instance.rebuild.start`` and ``instance.rebuild.end`` - and ``instance.rebuild.error`` notifications have been extended with the - ``trusted_image_certificates`` field that contains the list of trusted - certificate IDs used when the instance is rebuilt. This change also causes - the type of the payload object to change from ``InstanceActionPayload`` - version 1.6 to ``InstanceActionRebuildPayload`` version 1.7. See the - `notification dev reference`_ for the sample file of + and ``instance.rebuild.error`` versioned notifications have been extended + with the ``trusted_image_certificates`` field that contains the list of + trusted certificate IDs used when the instance is rebuilt. This change also + causes the type of the payload object to change from + ``InstanceActionPayload`` version 1.6 to ``InstanceActionRebuildPayload`` + version 1.7. See the `notification dev reference`_ for the sample file of ``instance.rebuild.start`` as an example. .. _notification dev reference: https://docs.openstack.org/developer/nova/notifications.html \ No newline at end of file