Module: check_mk
Branch: master
Commit: 4922b9f49696a0c2cacdb78c722a5b02f3c25ff6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4922b9f49696a0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 19 14:20:51 2014 +0100
#1505 FIX Snapshots are now bound to the used monitoring core
Snapshots created with CMC can not be restored on sites currently
using another core and vice versa. If you need to restore a snapshot
using another core, you might switch to this core, restore the snapshot
and then switch back to your former core.
---
.werks/1505 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 21 +++++++++++++++++++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/.werks/1505 b/.werks/1505
new file mode 100644
index 0000000..5a3edb3
--- /dev/null
+++ b/.werks/1505
@@ -0,0 +1,13 @@
+Title: Snapshots are now bound to the used monitoring core
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i7
+Date: 1416403159
+
+Snapshots created with CMC can not be restored on sites currently
+using another core and vice versa. If you need to restore a snapshot
+using another core, you might switch to this core, restore the snapshot
+and then switch back to your former core.
diff --git a/ChangeLog b/ChangeLog
index b43a02d..66bd4b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,7 @@
* 1492 FIX: Fixed too long URL bug when deleting a timeperiod right after creating
one
* 1498 FIX: Fixed displaying of global settings titles / help texts...
* 1502 FIX: Fixed removing elements from ListOf choices during complain phase
+ * 1505 FIX: Snapshots are now bound to the used monitoring core...
Notifications:
* 1512 Bulk notification can now be grouped according to custom macro values...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 432691f..c411961 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6436,6 +6436,22 @@ def get_snapshot_status(snapshot, validate_checksums = False):
else:
raise MKGeneralException(_("Invalid snapshot (missing file:
%s)") % entry)
+ def check_core():
+ if not defaults.omd_root:
+ return # Do not perform this check in non OMD environments
+ cmk_tar = cStringIO.StringIO(access_snapshot(lambda x:
multitar.get_file_content(x, 'check_mk.tar.gz')))
+ files = multitar.list_tar_content(cmk_tar)
+ using_cmc = os.path.exists(defaults.omd_root +
'/etc/check_mk/conf.d/microcore.mk')
+ snapshot_cmc = 'conf.d/microcore.mk' in files
+ if using_cmc and not snapshot_cmc:
+ raise MKGeneralException(_('You are currently using the Check_MK
Microcore, but this snapshot does not use the '
+ 'Check_MK Microcore. If you need to migrate
your data, you could consider changing '
+ 'the core, restoring the snapshot and changing
the core back again.'))
+ elif not using_cmc and snapshot_cmc:
+ raise MKGeneralException(_('You are currently not using the Check_MK
Microcore, but this snapshot uses the '
+ 'Check_MK Microcore. If you need to migrate
your data, you could consider changing '
+ 'the core, restoring the snapshot and changing
the core back again.'))
+
def snapshot_secret():
path = defaults.default_config_dir + '/snapshot.secret'
try:
@@ -6525,6 +6541,7 @@ def get_snapshot_status(snapshot, validate_checksums = False):
check_size()
check_extension()
check_content()
+ check_core()
if validate_checksums:
check_checksums()
@@ -6606,10 +6623,10 @@ def mode_snapshot_detail(phase):
html.write("<td>")
if verify_checksum:
- if values['checksum'] == True:
+ if values.get('checksum') == True:
checksum_title = _('Checksum valid and signed')
checksum_icon = ''
- elif values['checksum'] == False:
+ elif values.get('checksum') == False:
checksum_title = _('Checksum invalid and not signed')
checksum_icon = 'p'
else: