Module: check_mk
Branch: master
Commit: 35fc68045d195d0cd5d42ebb929766df1f3c5525
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35fc68045d195d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 12 10:19:54 2018 +0200
6559 OMD update is now warning when changing editions
During an "omd update" it is possible to switch between Check_MK Editions. For
example to upgrade from Check_MK Raw Edition to Check_MK Enterprise Editions.
It happened that users were accidentally updating Check_MK Enterprise Edition
based sites with Check_MK Raw Editions which e.g. results in reduced
functionality and performance.
During updates OMD is now comparing the old and new Check_MK Editions and asks
the user for confirmation once a change of the edition is detected.
CMK-677
Change-Id: I674cf96f9c126212bc55d4bc8aaa3d7c0c138d35
---
.werks/6559 | 18 ++++++++++++++++++
omd/packages/omd/omd | 26 ++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/.werks/6559 b/.werks/6559
new file mode 100644
index 0000000..65ef81e
--- /dev/null
+++ b/.werks/6559
@@ -0,0 +1,18 @@
+Title: OMD update is now warning when changing editions
+Level: 1
+Component: omd
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1536646773
+
+During an "omd update" it is possible to switch between Check_MK Editions.
For
+example to upgrade from Check_MK Raw Edition to Check_MK Enterprise Editions.
+It happened that users were accidentally updating Check_MK Enterprise Edition
+based sites with Check_MK Raw Editions which e.g. results in reduced
+functionality and performance.
+
+During updates OMD is now comparing the old and new Check_MK Editions and asks
+the user for confirmation once a change of the edition is detected.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index f3efb4e..e88118e 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -3264,6 +3264,14 @@ def main_update(args, options=None):
"Update!", "Abort"):
bail_out("Aborted.")
+ # In case the user changes the installed Check_MK Edition during update let the
+ # user confirm this step.
+ from_edition, to_edition = _get_edition(from_version), _get_edition(to_version)
+ if from_edition != to_edition and not opt_force and not dialog_yesno(
+ "You are updating from %s Edition to %s Edition. Is this intended?" %
+ (from_edition.title(), to_edition.title())):
+ bail_out("Aborted.")
+
start_logging(g_sitedir + '/var/log/update.log')
sys.stdout.write("%s - Updating site '%s' from version %s to
%s...\n\n" %
@@ -3302,6 +3310,24 @@ def main_update(args, options=None):
stop_logging()
+def _get_edition(omd_version):
+ """Returns the long Check_MK Edition name or "unknown" of
the given OMD version"""
+ parts = omd_version.split(".")
+ if parts[-1] == "demo":
+ edition_short = parts[-2]
+ else:
+ edition_short = parts[-1]
+
+ if edition_short == "cre":
+ return "raw"
+ elif edition_short == "cee":
+ return "enterprise"
+ elif edition_short == "cme":
+ return "managed"
+ else:
+ return "unknown"
+
+
def main_umount(args, options=None):
if options is None:
options = {}