bundles: code style improvements
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-02-12 20:37:36 +01:00
parent 2af911c29f
commit f52df58517
Signed by: kunsi
GPG key ID: 12E3D2136B818350
24 changed files with 80 additions and 95 deletions

View file

@ -1,20 +1,17 @@
from os.path import join
def collect_commands():
check_commands = {}
check_commands = {}
for bundle, bundle_config in node.metadata.get('icinga2_api', {}).items():
for service, service_config in bundle_config.get('services', {}).items():
# The default for check_command is also set in metadata.py
# and in icinga2 bundle
if (
service_config.get('check_command', 'sshmon') == 'sshmon' and
'vars.sshmon_command' in service_config and
'command_on_monitored_host' in service_config
):
check_commands[service_config['vars.sshmon_command']] = service_config['command_on_monitored_host']
return check_commands
for _, bundle_config in node.metadata.get('icinga2_api', {}).items():
for service, service_config in bundle_config.get('services', {}).items():
# The default for check_command is also set in metadata.py
# and in icinga2 bundle
if (
service_config.get('check_command', 'sshmon') == 'sshmon' and
'vars.sshmon_command' in service_config and
'command_on_monitored_host' in service_config
):
check_commands[service_config['vars.sshmon_command']] = service_config['command_on_monitored_host']
users = {
@ -31,8 +28,6 @@ pkg_apt = {
'monitoring-plugins': {},
}
check_commands = collect_commands()
with open(join(repo.path, 'data', 'sshmon', 'sshmon.pub'), 'r') as fp:
pubkey = fp.read().strip()

View file

@ -1,5 +1,3 @@
from bundlewrap.utils import Fault
from re import sub
defaults = {