Skip to content

Commit

Permalink
Merge pull request #22 from inettgmbh/bakery
Browse files Browse the repository at this point in the history
try to catch cases in which the bakery isn't available
  • Loading branch information
edvler authored Dec 9, 2021
2 parents c93fc73 + 177a20c commit 31c8322
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 51 deletions.
25 changes: 0 additions & 25 deletions check_mk/info

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
from pathlib import Path
from typing import Any, Dict

from .bakery_api.v1 import FileGenerator, OS, Plugin, register
try:
from .bakery_api.v1 import FileGenerator, OS, Plugin, register

def get_proxmox_qemu_backup_files(conf: Dict[str, Any]) -> FileGenerator:
yield Plugin(base_os=OS.LINUX, source=Path("proxmox_qemu_backup"))

register.bakery_plugin(
name="proxmox_qemu_backup",
files_function=get_proxmox_qemu_backup_files,
)
def get_proxmox_qemu_backup_files(conf: Dict[str, Any]) -> FileGenerator:
yield Plugin(base_os=OS.LINUX, source=Path("proxmox_qemu_backup"))

register.bakery_plugin(
name="proxmox_qemu_backup",
files_function=get_proxmox_qemu_backup_files,
)

except ImportError as error:
pass

42 changes: 23 additions & 19 deletions check_mk/web/plugins/wato/check_parameters_proxmox_qemu_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
HostRulespec,
rulespec_registry,
)
from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import (
RulespecGroupMonitoringAgentsAgentPlugins,
)
from cmk.gui.valuespec import (
DropdownChoice,
)
import cmk.utils.version as cmk_version

register_check_parameters(
subgroup_os,
Expand Down Expand Up @@ -69,23 +67,29 @@
match_type = "dict",
)

def _valuespec_proxmox_qemu_backup():
return DropdownChoice(
title = _("Proxmox VE guest backup"),
help = _(
"This will deploy the agent plugin <tt>proxmox_qemu_backup</tt>"
),
choices = [
(True, _("Deploy plugin for Proxmox VE guest backups")),
(False, _("Do not deploy plugin for Proxmox VE guest backups")),
]
if cmk_version.is_enterprise_version() or cmk_version.is_managed_version():
from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import (
RulespecGroupMonitoringAgentsAgentPlugins,
)

rulespec_registry.register(
HostRulespec(
group=RulespecGroupMonitoringAgentsAgentPlugins,
name="agent_config:proxmox_qemu_backup",
valuespec=_valuespec_proxmox_qemu_backup,

def _valuespec_proxmox_qemu_backup():
return DropdownChoice(
title = _("Proxmox VE guest backup"),
help = _(
"This will deploy the agent plugin <tt>proxmox_qemu_backup</tt>"
),
choices = [
(True, _("Deploy plugin for Proxmox VE guest backups")),
(False, _("Do not deploy plugin for Proxmox VE guest backups")),
]
)

rulespec_registry.register(
HostRulespec(
group=RulespecGroupMonitoringAgentsAgentPlugins,
name="agent_config:proxmox_qemu_backup",
valuespec=_valuespec_proxmox_qemu_backup,
)
)
)

0 comments on commit 31c8322

Please sign in to comment.