Skip to content

Commit eb24a0b

Browse files
committed
fix migration from older config
1 parent 88f320b commit eb24a0b

4 files changed

Lines changed: 30 additions & 23 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
context: .
88
dockerfile: dockerfiles/checkmk/Dockerfile
99
args:
10-
CHECKMK_VERSION: 2.4.0p19
10+
CHECKMK_VERSION: 2.4.0p20
1111
CMK_PASSWORD: cmkadmin
1212
CMK_SITE_ID: cmk
1313
restart: unless-stopped

dockerfiles/client/Dockerfile_fedora-43

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY check-mk-agent*.rpm /tmp/
55
RUN dnf -y install iproute \
66
lsof \
77
nmap-ncat \
8-
procps-ng \
8+
procps-ng
99

1010
RUN dnf -y install /tmp/*.rpm && \
1111
rm -f /tmp/check-mk-agent*.rpm

dockerfiles/client/Dockerfile_rocky-8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY check-mk-agent*.rpm /tmp/
55
RUN dnf -y install iproute \
66
lsof \
77
nmap-ncat \
8-
procps-ng \
8+
procps-ng
99

1010
RUN dnf -y install /tmp/*.rpm && \
1111
rm -f /tmp/check-mk-agent*.rpm

mkp/local/lib/python3/cmk_addons/plugins/yum/rulesets/yum_cee.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,53 @@
2929
# default interval in seconds
3030
DEFAULT_INTERVAL = 60.0
3131

32+
# used in migrate method per default - empty dictionary means no deployment
33+
DEFAULT_CONFIG = {
34+
'deploy': {
35+
'interval': dict()
36+
}
37+
}
38+
3239

3340
def _migrate_int_to_float(value: object) -> Mapping[str, object]:
3441
"""
3542
migrate from integer interval to float interval
3643
"""
3744

3845
# debugging - might become an option later
39-
#with open('/tmp/debug-migrate_int_to_float.txt', 'a') as debug_file:
46+
# with open('/tmp/debug-migrate_int_to_float.txt', 'a') as debug_file:
4047
# debug_file.write(f'value: {value}\n')
4148

4249
if value is not None:
4350
if value.get('deploy'):
44-
if value['deploy'].get('interval'):
45-
return {
46-
'deploy': {
47-
'interval': float(value['deploy']['interval'])
51+
if isinstance(value['deploy'], dict):
52+
if value['deploy'].get('interval'):
53+
return {
54+
'deploy': {
55+
'interval': float(value['deploy']['interval'])
56+
}
4857
}
49-
}
50-
else:
51-
return {
52-
'deploy': {
53-
'interval': dict()
58+
# backward compatiblility with tuple
59+
elif isinstance(value['deploy'], tuple):
60+
if len(value['deploy']) == 2:
61+
return {
62+
'deploy': {
63+
'interval': float(value['deploy'][1])
64+
}
5465
}
55-
}
66+
else:
67+
return DEFAULT_CONFIG
68+
else:
69+
return DEFAULT_CONFIG
5670
# backward compatibility - migrate from interval to deploy
5771
elif value.get('interval'):
5872
return {
5973
'deploy': {
6074
'interval': float(value['interval'])
6175
}
6276
}
63-
# backward compatibility
64-
elif value.get('nointerval'):
65-
return {
66-
'deploy': {
67-
'interval': dict()
68-
}
69-
}
70-
else:
71-
return value
77+
# if no other case matches just give back empty default config
78+
return DEFAULT_CONFIG
7279
else:
7380
# empty dictionary means no deployment
7481
return dict()

0 commit comments

Comments
 (0)