Module: check_mk
Branch: master
Commit: f603069c55f3c15560c835e178c67d49c88d7f28
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f603069c55f3c1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 7 12:00:36 2016 +0100
Added missing validation calls
---
web/htdocs/watolib.py | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 51b0f7f..f8b0074 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3914,42 +3914,28 @@ class ActivateChangesManager(ActivateChanges):
self._time_started = time.time()
self._snapshot_id = None
- # TODO
- # # Let host validators do their work
- # defective_hosts = validate_all_hosts([], force_all = True)
- # if defective_hosts:
- # raise MKUserError(None, _("You cannot activate changes
while some hosts have "
- # "an invalid configuration: ") + ",
".join(
- # [ '<a href="%s">%s</a>' %
(folder_preserving_link([("mode", "edit_host"), ("host",
hn)]), hn)
- # for hn in defective_hosts.keys() ]))
-
+ self._verify_valid_host_config()
self._save_activation()
self._pre_activate_changes()
-
- # TODO:
- # # Give hooks chance to do some pre-activation things (and maybe stop
- # # the activation)
- # try:
- # call_hook_pre_distribute_changes()
- # except Exception, e:
- # if config.debug:
- # raise
- # else:
- # raise MKUserError(None, "<h1>%s</h1>%s" %
(_("Cannot activate changes"), e))
- #
-
self._create_snapshots()
-
self._save_activation()
self._start_activation()
-
self._do_housekeeping()
return self._activation_id
+ def _verify_valid_host_config(self):
+ defective_hosts = validate_all_hosts([], force_all=True)
+ if defective_hosts:
+ raise MKUserError(None, _("You cannot activate changes while some hosts
have "
+ "an invalid configuration: ") + ", ".join(
+ [ '<a href="%s">%s</a>' %
(folder_preserving_link([("mode", "edit_host"), ("host",
hn)]), hn)
+ for hn in defective_hosts.keys() ]))
+
+
def activate_until(self):
return self._activate_until