1
# Copyright 2015 Canonical Ltd.
2
# This file is part of cloud-init. See LICENCE file for license information.
5
cloud-init reporting framework
7
The reporting framework is intended to allow all parts of cloud-init to
8
report events in a structured manner.
11
from ..registry import DictRegistry
12
from .handlers import available_handlers
15
'logging': {'type': 'log'},
19
def update_configuration(config):
20
"""Update the instanciated_handler_registry.
23
The dictionary containing changes to apply. If a key is given
24
with a False-ish value, the registered handler matching that name
27
for handler_name, handler_config in config.items():
28
if not handler_config:
29
instantiated_handler_registry.unregister_item(
30
handler_name, force=True)
32
handler_config = handler_config.copy()
33
cls = available_handlers.registered_items[handler_config.pop('type')]
34
instantiated_handler_registry.unregister_item(handler_name)
35
instance = cls(**handler_config)
36
instantiated_handler_registry.register_item(handler_name, instance)
39
instantiated_handler_registry = DictRegistry()
40
update_configuration(DEFAULT_CONFIG)