We use cookies to ensure that we give you the best experience on our website.  Visit our Privacy Policy to learn more. If you continue to use this site, we will assume that you are okay with it.

Your choices regarding cookies on this site.
Your preferences have been updated.
In order for the changes to take effect completely please clear your browser cookies and cache. Then reload the page.

Werk #10199: Bakery plugins must save the configuration into yml_store parameter

ComponentChecks & Agents
TitleBakery plugins must save the configuration into yml_store parameter
Date2019-11-14 12:21:48
Checkmk EditionCheckmk Raw Edition (CRE)
Checkmk Version1.7.0i1
LevelTrivial Change
ClassNew Feature
CompatibilityCompatible - no manual interaction needed

Previously the Bakery configured Windows Agent using check_mk.ini configuration file: every script in enterprise/agents/bakery directory could write own configuration data into the own file. All those files had been later gathered into one check_mk.ini configuration file.

Since this release the Bakery configures Windows Agent using only check_mk.bakery.yml. All data located in the ini file will be ignored.

To correctly configure Windows Agent you must use new parameter in your bake_*** function named yml_store. This parameter has type YamlStore and imported automatically from agent_bakery_plugins.py.

Now the configuration data of all plugins are stored in a standard Python dictionary, which replicates the structure of the Windows Agent's configuration file.

The following sample bake function sets the agent port setting for the Yaml file. It receives the configured port for the agent configuration and creates two entries, "enabled" and "port" in the "global" section.

def bake_agent_port(opsys, conf, conf_dir, plugins_dir, yml_store):
#                                                     ^^^^^^^^^
global_section = yml_store.make_section["global"] # mandatory to get dict
#                                        ^^^^^^
global_section["enabled"] = True  # mandatory also

global_section["port"] = conf  # configures the Agent port
#               ^^^^     ^^^^

The function above creates the following definitions in the check_mk.bakery.yml:

global:
enabled: True
port: 6551