Module: check_mk
Branch: master
Commit: c8a80f54ad4ff3134cc04e33ecd959a10dcb07b1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c8a80f54ad4ff3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 10 15:43:07 2017 +0200
4673 Agent bakery creates Solaris PKG packages now
The agent bakery can now pack solaris "pkg" packages now. With this change it
is now also possible to use the agent updater on solaris systems.
Change-Id: I5ce34330ed86cea20cb479685132b2bc42dcd198
---
.werks/4673 | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/.werks/4673 b/.werks/4673
new file mode 100644
index 0000000..9efcfc7
--- /dev/null
+++ b/.werks/4673
@@ -0,0 +1,11 @@
+Title: Agent bakery creates Solaris PKG packages now
+Level: 2
+Component: agents
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1494423234
+Class: feature
+
+The agent bakery can now pack solaris "pkg" packages now. With this change it
+is now also possible to use the agent updater on solaris systems.
Module: check_mk
Branch: master
Commit: 768c76a5498b5a8fb70bce213167028b633d375e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=768c76a5498b5a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed May 10 11:48:17 2017 +0200
Added hack to easily switch back and forth between recent versions of g++ and clang++.
Change-Id: I94adddd48ec416239d85e0b21e113fdcfb9eb665
---
Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index cc05538..24fd917 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,14 @@ TAROPTS := --owner=root --group=root --exclude=.svn --exclude=*~ \
--exclude=.gitignore --exclude=*.swp --exclude=.f12
CXX_FLAGS := -g -O3 -Wall -Wextra
+# HACK: Starting with GCC 6.1, g++ defaults to C++14, but even clang++-4.0 still
+# defaults to C++11. So when configure finds such a g++ first, the resulting
+# compilation database does not contain a -std=c++14 flag, because it's simply
+# not needed. But when we want to use our clang-based tools, it *is* needed. :-/
+# To work around that issue, we hackily add that flag below. This is ugly and
+# should be removed when the compiler defaults are in sync again.
+CXX_FLAGS += -std=c++14
+
CLANG_VERSION := 4.0
CLANG_FORMAT := clang-format-$(CLANG_VERSION)
CLANG_TIDY := clang-tidy-$(CLANG_VERSION)
Module: check_mk
Branch: master
Commit: 538aafe51f754ee365f49bbc1cd25f69a059d8f4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=538aafe51f754e…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed May 10 11:32:41 2017 +0200
Added a tragic story about a little, buggy bear...
Change-Id: Ib0d6648e7528ab2c51e9ed905b803bfbe5742ba9
---
Makefile | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Makefile b/Makefile
index f3a4abe..cc05538 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,23 @@ SCAN_BUILD := scan-build-$(CLANG_VERSION)
CPPCHECK := cppcheck
DOXYGEN := doxygen
IWYU_TOOL := tests/iwyu_tool_jenkins.py
+
+# The Bear versions have a slightly tragic history: Due to the clang bug
+# https://llvm.org/bugs/show_bug.cgi?id=24710 we need absolute paths in our
+# compilation database. Furthermore, gcc and clang have slightly different
+# behavior regarding include paths when the -I flag contains a relative path and
+# symlinks are involved, so this is yet another reason to use absolute paths.
+#
+# Consequently, we upstreamed a fix for this to the Bear project, see
+# https://github.com/rizsotto/Bear/commit/fb1645de9. This fix lived happily in
+# the Bear releases 2.1.4, 2.1.5, and 2.2.0, but after that, some "improvements"
+# broke the fix again. :-/ Until a new fix has been upstreamed, make sure that
+# that you use the right Bear.
+#
+# To install a working version locally, just do:
+# git clone https://github.com/rizsotto/Bear.git && cd Bear && git checkout 2.2.0 && cmake -DCMAKE_INSTALL_PREFIX=$HOME/local/Bear-2.2.0 && make install
+# and put $HOME/local/Bear-2.2.0/bin into your PATH or set the make variable
+# below accordingly.
BEAR := bear
M4_DEPS := $(wildcard m4/*) configure.ac
Module: check_mk
Branch: master
Commit: 3605225ea7a0e4fb4162e3760e89c7c441af0c30
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3605225ea7a0e4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 10 08:39:04 2017 +0200
4672 FIX Activation: Discard of changes is now possible again
The "discard changes" button which could be used to revert the pending
changes in WATO to the last activated configuration was removes during
1.4 development.
The main reason for this is that the snapshot feature of WATO is being
dropped and replaced in Check_MK 1.5 by some better mechanism.
Change-Id: Ic746638a44639a6fbf05d0090b8b89eba22c9f6f
---
.werks/4672 | 16 ++++++++++
web/htdocs/js/wato.js | 2 ++
web/htdocs/wato.py | 87 ++++++++++++++++++++++++++++++++++++++++++++++++---
web/htdocs/watolib.py | 28 ++++++++++-------
4 files changed, 118 insertions(+), 15 deletions(-)
diff --git a/.werks/4672 b/.werks/4672
new file mode 100644
index 0000000..3efcb69
--- /dev/null
+++ b/.werks/4672
@@ -0,0 +1,16 @@
+Title: Activation: Discard of changes is now possible again
+Level: 2
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1494398195
+
+The "discard changes" button which could be used to revert the pending
+changes in WATO to the last activated configuration was removes during
+1.4 development.
+
+The main reason for this is that the snapshot feature of WATO is being
+dropped and replaced in Check_MK 1.5 by some better mechanism.
diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js
index 3415c0d..aa28f57 100644
--- a/web/htdocs/js/wato.js
+++ b/web/htdocs/js/wato.js
@@ -645,6 +645,8 @@ function lock_activation_controls(lock)
var elements = [];
elements.push(document.getElementById("activate_affected"));
elements.push(document.getElementById("activate_selected"));
+ // TODO: Remove once new changes mechanism has been implemented
+ elements.push(document.getElementById("discard_changes_button"));
elements = elements.concat(Array.prototype.slice.call(document.getElementsByName("activate_p_comment"), 0));
elements = elements.concat(Array.prototype.slice.call(document.getElementsByClassName("site_checkbox"), 0));
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4279ffb..226cbb3 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5235,18 +5235,97 @@ class ModeActivateChanges(WatoMode, ActivateChanges):
def buttons(self):
home_button()
+ # TODO: Remove once new changes mechanism has been implemented
+ if config.user.may("wato.activate") and self.has_changes() and self._get_last_wato_snapshot_file():
+ html.context_button(_("Discard Changes!"),
+ html.makeactionuri([("_action", "discard")]),
+ "discard", id="discard_changes_button")
+
if config.user.may("wato.sites"):
html.context_button(_("Site Configuration"), folder_preserving_link([("mode", "sites")]), "sites")
if config.user.may("wato.auditlog"):
html.context_button(_("Audit Log"), folder_preserving_link([("mode", "auditlog")]), "auditlog")
- #if config.guitests_enabled:
- # html.context_button(_("Reschedule All"), "guitest_reschedule_all.py", "guitest")
-
def action(self):
- pass
+ if html.var("_action") != "discard":
+ return
+
+ if not html.check_transaction():
+ return
+
+ # TODO: Remove once new changes mechanism has been implemented
+ # Now remove all currently pending changes by simply restoring the last automatically
+ # taken snapshot. Then activate the configuration. This should revert all pending changes.
+ file_to_restore = self._get_last_wato_snapshot_file()
+
+ if not file_to_restore:
+ raise MKUserError(None, _('There is no WATO snapshot to be restored.'))
+
+ msg = _("Discarded pending changes (Restored %s)") % file_to_restore
+
+ # All sites and domains can be affected by a restore: Better restart everything.
+ add_change("changes-discarded", msg, sites=self.activation_site_ids(),
+ domains=ConfigDomain.enabled_domains(),
+ need_restart=True)
+
+ self._extract_snapshot(file_to_restore)
+ execute_activate_changes([ d.ident for d in ConfigDomain.enabled_domains() ])
+
+ for site_id in self.activation_site_ids():
+ self.confirm_site_changes(site_id)
+
+ html.header(self.title(), javascripts=["wato"], stylesheets=wato_styles,
+ show_body_start=display_options.enabled(display_options.H),
+ show_top_heading=display_options.enabled(display_options.T))
+ html.open_div(class_="wato")
+
+ html.begin_context_buttons()
+ home_button()
+ html.end_context_buttons()
+
+ html.message(_("Successfully discarded all pending changes."))
+ html.javascript("hide_changes_buttons();")
+ html.footer()
+
+ return False
+
+
+ # TODO: Remove once new changes mechanism has been implemented
+ def _extract_snapshot(self, snapshot_file):
+ self._extract_from_file(snapshot_dir + snapshot_file, backup_domains)
+
+
+ # TODO: Remove once new changes mechanism has been implemented
+ def _extract_from_file(self, filename, elements):
+ import tarfile
+ if type(elements) == list:
+ multitar.extract(tarfile.open(filename, "r"), elements)
+
+ elif type(elements) == dict:
+ multitar.extract_domains(tarfile.open(filename, "r"), elements)
+
+
+ # TODO: Remove once new changes mechanism has been implemented
+ def _get_last_wato_snapshot_file(self):
+ for snapshot_file in self._get_snapshots():
+ status = get_snapshot_status(snapshot_file)
+ if status['type'] == 'automatic' and not status['broken']:
+ return snapshot_file
+
+
+ # TODO: Remove once new changes mechanism has been implemented
+ def _get_snapshots(self):
+ snapshots = []
+ try:
+ for f in os.listdir(snapshot_dir):
+ if os.path.isfile(snapshot_dir + f):
+ snapshots.append(f)
+ snapshots.sort(reverse=True)
+ except OSError:
+ pass
+ return snapshots
def page(self):
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 1131060..5133622 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -218,17 +218,7 @@ def log_audit(linkinfo, action, message, user_id = None):
def confirm_all_local_changes():
- site_id = config.omd_site()
-
- try:
- os.unlink(site_changes_path(site_id))
- except OSError, e:
- if e.errno == 2:
- pass # Not existant -> OK
- else:
- raise
-
- need_sidebar_reload()
+ ActivateChanges().confirm_site_changes(config.omd_site())
#
@@ -3992,6 +3982,18 @@ class ActivateChanges(object):
return changes
+ def confirm_site_changes(self, site_id):
+ try:
+ os.unlink(site_changes_path(site_id))
+ except OSError, e:
+ if e.errno == 2:
+ pass # Not existant -> OK
+ else:
+ raise
+
+ need_sidebar_reload()
+
+
def _save_site_changes(self, site_id, changes):
# First truncate the file
open(site_changes_path(site_id), "w")
@@ -5027,6 +5029,7 @@ def execute_activate_changes(domains):
# '----------------------------------------------------------------------'
# TODO: May be removed in near future.
+# TODO: Remove once new changes mechanism has been implemented
def create_snapshot(comment):
make_nagios_directory(snapshot_dir)
@@ -5053,6 +5056,7 @@ def create_snapshot(comment):
return snapshot_name
+# TODO: Remove once new changes mechanism has been implemented
def do_create_snapshot(data):
snapshot_name = data["snapshot_name"]
snapshot_dir = cmk.paths.var_dir + "/wato/snapshots"
@@ -5141,6 +5145,7 @@ def do_create_snapshot(data):
shutil.rmtree(work_dir)
+# TODO: Remove once new changes mechanism has been implemented
def do_snapshot_maintenance():
snapshots = []
for f in os.listdir(snapshot_dir):
@@ -5157,6 +5162,7 @@ def do_snapshot_maintenance():
# Returns status information for snapshots or snapshots in progress
+# TODO: Remove once new changes mechanism has been implemented
def get_snapshot_status(snapshot, validate_checksums = False):
if type(snapshot) == tuple:
name, file_stream = snapshot
Module: check_mk
Branch: master
Commit: 38e5e16be689bdd5acd34d74627098a5dbda6357
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=38e5e16be689bd…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue May 9 16:24:56 2017 +0200
4696 FIX mk_logwatch.exe in windows: now supports IPv6 addresses, fixed path of statefile
The mk_logwatch.exe crashed whenever an IPv6 host queried the system.
The logwatch statefile is now located in the state directory instead of the agent directory.
Change-Id: I14e2ccd9401d1212438de80df14ca4234332bdce
---
.werks/4696 | 12 ++++++++++++
agents/plugins/mk_logwatch | 3 ++-
agents/windows/plugins/mk_logwatch.exe | Bin 4563948 -> 4555443 bytes
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/4696 b/.werks/4696
new file mode 100644
index 0000000..d78dc84
--- /dev/null
+++ b/.werks/4696
@@ -0,0 +1,12 @@
+Title: mk_logwatch.exe in windows: now supports IPv6 addresses, fixed path of statefile
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1494339798
+Class: fix
+
+The mk_logwatch.exe crashed whenever an IPv6 host queried the system.
+The logwatch statefile is now located in the state directory instead of the agent directory.
+
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index 0da34a8..7ff4fb9 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -138,7 +138,7 @@ if logwatch_dir:
mk_vardir = logwatch_dir
else:
mk_confdir = os.getenv("MK_CONFDIR") or "."
- mk_vardir = os.getenv("MK_VARDIR") or "."
+ mk_vardir = os.getenv("MK_VARDIR") or os.getenv("MK_STATEDIR") or "."
sys.stdout.write("<<<logwatch>>>\n")
@@ -152,6 +152,7 @@ config_dir = mk_confdir + "/logwatch.d/*.cfg"
# $REMOTE not set and a tty -> logwatch.state.local
# $REMOTE not set and not a tty -> logwatch.state
remote_hostname = os.getenv("REMOTE", "")
+remote_hostname = remote_hostname.replace(":", "_")
if remote_hostname != "":
status_filename = "%s/logwatch.state.%s" % (mk_vardir, remote_hostname)
else:
diff --git a/agents/windows/plugins/mk_logwatch.exe b/agents/windows/plugins/mk_logwatch.exe
index 8d1119b..3407f7b 100755
Binary files a/agents/windows/plugins/mk_logwatch.exe and b/agents/windows/plugins/mk_logwatch.exe differ