add missing notification samples to dev ref

The already transformed aggregate notifications were missing from the
notification dev-ref due to a missing import in the doc generation code.

This patch improves the doc generation to automatically pick up new modules
added under nova.notitications.objects.

Change-Id: I688bc59f19814956d73e04b4970add21ce64ba90
Closes-Bug: #1698779
This commit is contained in:
Balazs Gibizer 2017-06-19 11:42:49 +02:00
parent 3e732d332a
commit 5a35a2b99e

View File

@ -20,18 +20,14 @@ It is used via a single directive in the .rst file
"""
from sphinx.util.compat import Directive
from docutils import nodes
import importlib
from sphinx.util.compat import Directive
import pkgutil
import nova.notifications.objects
from nova.notifications.objects import base as notification
from nova.objects import base
# Make sure that all the notification classes are defined so the
# registration mechanism can pick them up later.
from nova.notifications.objects import exception
from nova.notifications.objects import flavor
from nova.notifications.objects import instance
from nova.notifications.objects import keypair
from nova.notifications.objects import service
class VersionedNotificationDirective(Directive):
@ -52,7 +48,13 @@ jQuery(document).ready(function(){
notifications = self._collect_notifications()
return self._build_markup(notifications)
def _import_all_notification_packages(self):
map(lambda module: importlib.import_module(module),
('nova.notifications.objects.' + name for _, name, _ in
pkgutil.iter_modules(nova.notifications.objects.__path__)))
def _collect_notifications(self):
self._import_all_notification_packages()
base.NovaObjectRegistry.register_notification_objects()
notifications = []
ovos = base.NovaObjectRegistry.obj_classes()