Fix the usage of instance.snapshot notification sample

The instance.snapshot.start and .end notification sample file was
attached to two different Notification ovo by mistake. This caused that
the samples are appeared in the notification dev-ref twice.

This patch removes the duplication and adds a simple check to the doc
generation code to detech such problems in the future.

Change-Id: I8478c134f9cdb08c02a44e1838dbacede5523914
Closes-Bug: #1732685
This commit is contained in:
Balazs Gibizer 2017-11-16 13:55:39 +01:00 committed by Stephen Finucane
parent 9633ebdf37
commit ff4f58fcd2
2 changed files with 9 additions and 7 deletions

View File

@ -63,7 +63,7 @@ jQuery(document).ready(function(){
def _collect_notifications(self):
self._import_all_notification_packages()
base.NovaObjectRegistry.register_notification_objects()
notifications = []
notifications = {}
ovos = base.NovaObjectRegistry.obj_classes()
for name, cls in ovos.items():
cls = cls[0]
@ -73,10 +73,14 @@ jQuery(document).ready(function(){
payload_name = cls.fields['payload'].objname
payload_cls = ovos[payload_name][0]
for sample in cls.samples:
notifications.append((cls.__name__,
payload_cls.__name__,
sample))
return sorted(notifications)
if sample in notifications:
raise ValueError('Duplicated usage of %s '
'sample file detected' % sample)
notifications[sample] = ((cls.__name__,
payload_cls.__name__,
sample))
return sorted(notifications.values())
def _build_markup(self, notifications):
content = []

View File

@ -411,8 +411,6 @@ class InstanceStateUpdatePayload(base.NotificationPayloadBase):
@base.notification_sample('instance-reboot-error.json')
@base.notification_sample('instance-shutdown-start.json')
@base.notification_sample('instance-shutdown-end.json')
@base.notification_sample('instance-snapshot-start.json')
@base.notification_sample('instance-snapshot-end.json')
@base.notification_sample('instance-interface_attach-start.json')
@base.notification_sample('instance-interface_attach-end.json')
@base.notification_sample('instance-interface_attach-error.json')