Module: check_mk
Branch: master
Commit: 573bb7b3cb1cd259ab9ff1182326567ab9728edf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=573bb7b3cb1cd2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 21 08:27:54 2016 +0100
WATO: Cleaned up deprecated is_distributed() function
Change-Id: I52985e59bfd22b7b1a923eb17b2b7382ca0d6592
---
web/htdocs/wato.py | 40 ++++++++++++++++++----------------------
web/htdocs/watolib.py | 7 -------
web/plugins/userdb/ldap.py | 2 +-
web/plugins/visuals/wato.py | 3 +--
4 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2402969..87b13f5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -30,10 +30,6 @@
# and implement AJAX handlers. It uses classes, functions and globals
# from watolib.py.
-# CLEANUP: is_distributed() now always returns True. Remove all occurrances
-# of this function as soon as we know that everything still works without
-# the old "single" mode.
-
# .--README--------------------------------------------------------------.
# | ____ _ |
# | | _ \ ___ __ _ __| | _ __ ___ ___ |
@@ -7930,7 +7926,7 @@ def mode_user_notifications(phase, profilemode):
log_text = _("Deleted notification rule %d of user %s") % (nr, userid)
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
else:
@@ -7953,7 +7949,7 @@ def mode_user_notifications(phase, profilemode):
log_text = _("Changed position of notification rule %d of user %s") % (from_pos, userid)
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
else:
@@ -8052,7 +8048,7 @@ def mode_notification_rule(phase, profilemode):
log_text = _("Changed notification rule %d") % edit_nr + suffix
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
return # don't redirect to other page
@@ -8799,21 +8795,21 @@ def mode_sites(phase):
# will be removed.
test_sites = dict(configured_sites.items())
del test_sites[delid]
- if is_distributed(test_sites):
- # Make sure that site is not being used by hosts and folders
- if delid in Folder.root_folder().all_site_ids():
- search_url = html.makeactionuri([
- ("host_search_change_site", "on"),
- ("host_search_site", delid),
- ("host_search", "1"),
- ("folder", ""),
- ("mode", "search"),
- ("filled_in", "edit_host"),
- ])
- raise MKUserError(None,
- _("You cannot delete this connection. It has folders/hosts "
- "assigned to it. You can use the <a href=\"%s\">host "
- "search</a> to get a list of the hosts.") % search_url)
+
+ # Make sure that site is not being used by hosts and folders
+ if delid in Folder.root_folder().all_site_ids():
+ search_url = html.makeactionuri([
+ ("host_search_change_site", "on"),
+ ("host_search_site", delid),
+ ("host_search", "1"),
+ ("folder", ""),
+ ("mode", "search"),
+ ("filled_in", "edit_host"),
+ ])
+ raise MKUserError(None,
+ _("You cannot delete this connection. It has folders/hosts "
+ "assigned to it. You can use the <a href=\"%s\">host "
+ "search</a> to get a list of the hosts.") % search_url)
c = wato_confirm(_("Confirm deletion of site %s") % delid,
_("Do you really want to delete the connection to the site %s?") % delid)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 3e21cca..2b5ceb1 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3510,13 +3510,6 @@ def do_remote_automation(site, command, vars):
return response
-# Determine, if we have any slaves to distribute
-# configuration to.
-def is_distributed(sites = None):
- # TODO: Remove all calls of this function
- return True
-
-
# Returns the ID of the default site. This is the site the main folder has
# configured by default. It inherits to all folders and hosts which don't have
# a site set on their own.
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 0a48111..6dcf32a 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -1027,7 +1027,7 @@ class LDAPUserConnector(UserConnector):
pw_changed = True
# Synchronize new user profile to remote sites if needed
- if pw_changed and not changed and wato.is_distributed():
+ if pw_changed and not changed and wato.has_wato_slave_sites():
synchronize_profile_to_sites(self, user_id, user)
if changed:
diff --git a/web/plugins/visuals/wato.py b/web/plugins/visuals/wato.py
index 7e3c860..bbdd897 100644
--- a/web/plugins/visuals/wato.py
+++ b/web/plugins/visuals/wato.py
@@ -38,8 +38,7 @@ class FilterWatoFile(Filter):
# This filter is also available on slave sites with disabled WATO
# To determine if this site is a slave we check the existance of the distributed_wato.mk
# file and the absence of any site configuration
- return (config.wato_enabled or\
- (not wato.is_distributed() and os.path.exists(cmk.paths.check_mk_config_dir + "/distributed_wato.mk")))\
+ return (config.wato_enabled or wato.is_wato_slave_site())
def load_wato_data(self):
Module: check_mk
Branch: master
Commit: c81bef3de89e70f5c754f7fb65cc419da3977d36
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c81bef3de89e70…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Tue Dec 20 17:17:54 2016 +0100
4119 FIX check_mk_agent.solaris: fixed run_cached function
Previously the run_cached function simply exited if cache file $CACHEFILE.new was too old.
This has been fixed now, the function acts just like in the Linux agent - it removes the process of the file as well as the file itself.
Change-Id: I886c524ac21280eae54531a66808ab407ab84dc7
---
.werks/4119 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 3 ++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/4119 b/.werks/4119
new file mode 100644
index 0000000..c3fbb7c
--- /dev/null
+++ b/.werks/4119
@@ -0,0 +1,11 @@
+Title: check_mk_agent.solaris: fixed run_cached function
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1482250470
+
+Previously the run_cached function simply exited if cache file $CACHEFILE.new was too old.
+This has been fixed now, the function acts just like in the Linux agent - it removes the process of the file as well as the file itself.
diff --git a/ChangeLog b/ChangeLog
index 10af144..2773636 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
NOTE: Please refer to the migration notes!
* 4208 FIX: mk_jolokia: Plugin now works with jolokia versions requiring the base url to finish with a slash...
* 4174 FIX: added missing perfometer for interface services
+ * 4119 FIX: check_mk_agent.solaris: fixed run_cached function...
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can now be configured via global settings....
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 1e73af4..f8b1b23 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -91,7 +91,8 @@ function run_cached () {
if [ -e "$CACHEFILE.new" ] ; then
AGE=$(file_age "$CACHEFILE.new")
if [ $AGE -ge $((MAXAGE * 2)) ] ; then
- return
+ fuser -k "$CACHEFILE.new" >/dev/null 2>&1
+ rm -f "$CACHEFILE.new"
fi
fi