diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-08-06 23:51:17 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-08-06 23:51:17 -0500 |
commit | fc5fc6e476059327d4063f165170cdde01db4100 (patch) | |
tree | f03b2feda3a4eecd339a821d6219ac3ef9c07428 /cloudinit/reporting/__init__.py | |
parent | ebd393e56ba21f8a84571dff499e6d6fb6852042 (diff) | |
download | vyos-cloud-init-fc5fc6e476059327d4063f165170cdde01db4100.tar.gz vyos-cloud-init-fc5fc6e476059327d4063f165170cdde01db4100.zip |
add the webhook handler
Diffstat (limited to 'cloudinit/reporting/__init__.py')
-rw-r--r-- | cloudinit/reporting/__init__.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/reporting/__init__.py b/cloudinit/reporting/__init__.py index d0bc14e3..b9d4f679 100644 --- a/cloudinit/reporting/__init__.py +++ b/cloudinit/reporting/__init__.py @@ -9,8 +9,8 @@ The reporting framework is intended to allow all parts of cloud-init to report events in a structured manner. """ -from cloudinit.registry import DictRegistry -from cloudinit.reporting.handlers import available_handlers +from ..registry import DictRegistry +from ..reporting.handlers import available_handlers FINISH_EVENT_TYPE = 'finish' @@ -18,6 +18,7 @@ START_EVENT_TYPE = 'start' DEFAULT_CONFIG = { 'logging': {'type': 'log'}, + 'print': {'type': 'print'}, } @@ -83,8 +84,14 @@ def update_configuration(config): instantiated_handler_registry.unregister_item( handler_name, force=True) continue + registered = instantiated_handler_registry.registered_items handler_config = handler_config.copy() cls = available_handlers.registered_items[handler_config.pop('type')] + if (handler_name in registered and + (registered[handler_name] == handler_config)): + continue + else: + instantiated_handler_registry.unregister_item(handler_name) instance = cls(**handler_config) instantiated_handler_registry.register_item(handler_name, instance) |