bakery_api.v1
- class OS(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumDescribes an operating system in the context of the Bakery API.
- LINUX = 'linux'
Describes a Linux target system
- SOLARIS = 'solaris'
Describes a Solaris target system
- AIX = 'aix'
Describes an AIX target system
- WINDOWS = 'windows'
Describes a Windows target system
- class DebStep(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
StrEnumDescribes a step in the processing of a DEB package.
- PREINST = 'preinst'
Describes a maintainer script, that will be executed before package installation
- POSTINST = 'postinst'
Describes a maintainer script, that will be executed right after package installation
- PRERM = 'prerm'
Describes a maintainer script, that will be executed right before package uninstallation
- POSTRM = 'postrm'
Describes a maintainer script, that will be executed after package uninstallation
- class RpmStep(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
StrEnumDescribes a step in the processing of a RPM package.
- PRE = 'pre'
Describes a scriptlet, that will be executed before package installation
- POST = 'post'
Describes a scriptlet, that will be executed right after package installation
- PREUN = 'preun'
Describes a scriptlet, that will be executed right before package uninstallation
- POSTUN = 'postun'
Describes a scriptlet, that will be executed right after package uninstallation
- PRETRANS = 'pretrans'
Describes a scriptlet, that will be executed before a complete package transaction
- POSTTRANS = 'posttrans'
Describes a scriptlet, that will be executed after a complete package transaction
- class SolStep(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
StrEnumDescribes a step in the processing of a Solaris PKG package.
- PREINSTALL = 'preinstall'
Describes an installation script, that will be executed before package installation
- POSTINSTALL = 'postinstall'
Describes an installation script, that will be executed right after package installation
- PREREMOVE = 'preremove'
Describes an installation script, that will be executed right before package uninstallation
- POSTREMOVE = 'postremove'
Describes an installation script, that will be executed after package uninstallation
- class Plugin(*, base_os, source, target=None, interval=None, asynchronous=None, timeout=None, retry_count=None)
Bases:
objectFile artifact that represents a Checkmk agent plugin
The specified plug-in file will be deployed to the Checkmk agent’s plug-in directory as a callable plugin.
- Parameters:
base_os (
OS) – The target operating system.source (
Path) – Path of the plug-in file, relative to the plug-in source directory on the Checkmk site. This usually consists only of the filename.target (
Path|None) – Target path, relative to the plug-in directory within the agent’s file tree on the target system. If omitted, the plug-in will be deployed under it’s relative source path/filename.interval (
int|None) – Caching interval in seconds. The plug-in will only be executed by the agent after the caching interval is elapsed.asynchronous (
bool|None) – Relevant for Windows Agent. Don’t wait for termination of the plugin’s process if True. An existent interval will always result in asynchronous execution.timeout (
int|None) – Relevant for Windows Agent. Maximum waiting time for a plug-in to terminate.retry_count (
int|None) – Relevant for Windows Agent. Maximum number of retried executions after a failed plug-in execution.
- class PluginConfig(*, base_os, lines, target, include_header=False)
Bases:
objectFile artifact that represents a generated config file for a plugin.
The resulting configuration file will be placed to the agent’s config directory (by default, ‘/etc/check_mk’, configurable in WATO) and is meant to be read by the corresponding plugin. It’s content is unrestricted (apart from the fact that it must be passed as a list of ‘str’s), so it’s up to the consuming plug-in to process it correctly.
- Parameters:
base_os (
OS) – The target operating system.lines (
Iterable[str]) – Lines of text that will be printed to the resulting file.target (
Path) – Path of the resulting configuration file, relative to the agent’s config directory. This usually consists only of the filename.include_header (
bool) –If True, the following header will be prepended at the start of the resulting configuration file:
# Created by Check_MK Agent Bakery.
# This file is managed via WATO, do not edit manually or you
# lose your changes next time when you update the agent.
- class SystemConfig(*, base_os, lines, target, include_header=False)
Bases:
objectFile artifact that represents a generated configuration file for the target system.
This is only relevant for UNIX systems.
The resulting configuration file will be placed under ‘/etc’ on the target system. This can be used, for example, to deploy a systemd service or to deploy a config file to a service’s <service>.d directory.
- Parameters:
base_os (
OS) – The target operating system.lines (
list[str]) – Lines of text that will be printed to the resulting file.target (
Path) – Path of the resulting configuration file, relative to ‘/etc’.include_header (
bool) –If True, the following header will be prepended at the start of the resulting configuration file:
# Created by Check_MK Agent Bakery.
# This file is managed via WATO, do not edit manually or you
# lose your changes next time when you update the agent.
- class SystemBinary(*, base_os, source, target=None)
Bases:
objectFile artifact that represents a script/program that should be deployed on the hosts.
Under UNIX, the file will be deployed to the binary directory (by default, ‘/usr/bin’, configurable in WATO).
Under Windows, the file will be deployed to the ‘bin’-folder at the agent’s installation directory.
- Parameters:
base_os (
OS) – The target operating system.source (
Path) – Path of the file, relative to the agent source directory on the Checkmk site.target (
Path|None) – Target path, relative to the binart directory on the target system. If omitted, the plug-in will be deployed under it’s relative source path/filename.
- class Scriptlet(*, step, lines)
Bases:
objectRepresents a ‘Scriptlet’ (RPM), ‘Maintainer script’ (DEB) or ‘Installation script’ (Solaris PKG)
Describes a shell script that should be executed at a specific time during a package transition, i.e. package installation, update, or uninstallation. For a detailed explanation of the meaning and the execution time of the steps/scripts, please refer to the documentation of the three packaging systems.
- Parameters:
step (
DebStep|RpmStep|SolStep) – Takes any Enum of the types ‘RpmStep’, ‘DebStep’, ‘SolStep’, e.g. RpmStep.POST for a scriptlet that should be executed right after package installation.lines (
list[str]) – Lines of text that the scriptlet consists of. Don’t add a shebang line - The executing shell depends on the packaging system. Usually, this will be the Bourne shell (sh), so the scriptlets should be compatible to that.
- class WindowsConfigEntry(*, path, content)
Bases:
objectConfig Entry for the Windows Agent yaml file (check_mk.install.yml)
It’s up to the consuming plug-in to read the config entry correctly from the yaml file. However, unlike the approach via PluginConfig, config entries described here will be accessible consistently via the python yaml module.
The logical structure of the yaml tree has up to two levels. It is divided into sections, that are again divided into subsections.
A config entry can be inserted to a section or a subsection.
- Parameters:
path (
list[str]) – The path to the entry consists either of [‘section’, ‘subsection’, ‘name’] or [‘section’, ‘name’], i.e. the resulting list must contain 2 or 3 entries. If the path already exists in the yaml structure, it will be overwritten.content (
int|str|bool|dict|list) – The actual content of the config entry. Allowed types are int, str, bool, dict, list. Must not contain any complex data types or custom classes. (Must be serializable with yaml.safe_dump)
- class WindowsConfigItems(*, path, content)
Bases:
objectList of entries for the Windows Agent yaml file (check_mk.install.yml)
This artifact describes a list of entries that is identified by a path (section,[ subsection,] name). In contrast to a WindowsConfigEntry, the given list will be merged to an already existing list.
- Parameters:
path (
list[str]) – The path to the entry consists either of [‘section’, ‘subsection’, ‘name’] or [‘section’, ‘name’], i.e. the resulting list must contain 2 or 3 entries. If the path already exists in the yaml structure, it will be overwritten.content (
list[int|str|bool|dict|list]) – The list that should be added or merged to the given path. Allowed list entries are the same as for WindowsConfigEntry content.
- class WindowsGlobalConfigEntry(*, name, content)
Bases:
objectShortcut for WindowsConfigEntry(path=[‘global’, name], content=content)
For details about the ‘global’ section and it’s meaning, please refer to the Windows Agent documentation.
- Parameters:
name (
str) – The name part of the [‘global’,name] pathcontent (
int|str|bool|dict|list) – The content, according to the WindowsConfigEntry requirements.
- class WindowsSystemConfigEntry(*, name, content)
Bases:
objectShortcut for WindowsConfigEntry(path=[‘system’, name], content=content)
For details about the ‘system’ section and it’s meaning, please refer to the Windows Agent documentation.
- Parameters:
name (
str) – The name part of the [‘global’,name] pathcontent (
int|str|bool|dict|list) – The content, according to the WindowsConfigEntry requirements.
- quote_shell_string(s)
Quote a string for use in a shell command.
This function is deprecated and is just an alias for shlex.quote. It will remain available in bakery API v1, but may be removed in a future version of the API. It is recommended to use shlex.quote instead.
- Return type:
str