Module: check_mk
Branch: master
Commit: fd3b0d5a2524f45376d4ce05ef51df204c68bdbe
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd3b0d5a2524f4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 4 16:36:40 2016 +0100
Using better function to get the local site id
---
web/htdocs/config.py | 1 +
web/htdocs/wato.py | 11 +++--------
web/htdocs/watolib.py | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 6a81da8..1ef46c1 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -662,6 +662,7 @@ def site(site_id):
return s
+# TODO: Does this work when using liveproxyd locally?
def site_is_local(site_name):
s = sites.get(site_name, {})
sock = s.get("socket")
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index b30f389..5c9c74a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -4830,7 +4830,7 @@ class ModeActivateChanges(WatoMode, ActivateChanges):
"activate_changes(\"affected\")")
html.jsbutton("activate_selected", _("Activate selected"),
"activate_changes(\"selected\")")
- # TODO: Revert button?
+
html.hidden_fields()
html.end_form()
@@ -9358,10 +9358,6 @@ def mode_edit_site(phase):
save_sites(configured_sites)
- # TODO: Why?
- # Own site needs RESTART in any case
- # update_replication_status(our_site_id(), { "need_restart" : True })
-
if new:
msg = _("Created new connection to site %s") % id
else:
@@ -9371,7 +9367,7 @@ def mode_edit_site(phase):
# affecting all domains
add_change("edit-sites", msg, sites=[id], domains=ConfigDomain.all_classes())
- if id != our_site_id():
+ if id != config.omd_site():
# On central site issue a change only for the GUI
# NOTE: Was marking all to be restarted (ec and core) before, but I don't
# think that this was really needed.
@@ -9637,7 +9633,7 @@ def automation_push_profile():
if not user_id:
raise MKGeneralException(_("Missing variable user_id"))
- our_id = our_site_id()
+ our_id = config.omd_site()
if our_id != None and our_id != site_id:
raise MKGeneralException(
@@ -13986,7 +13982,6 @@ def user_profile_async_replication_dialog():
html.icon(status_txt, icon)
if start_sync:
- # TODO: Change to new functions
estimated_duration = srs.get("times", {}).get(ACTIVATION_TIME_PROFILE_SYNC, 2.0)
html.javascript('wato_do_profile_replication(\'%s\', %d, \'%s\');' %
(site_id, int(estimated_duration * 1000.0), _('Replication in progress')))
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 08311d1..72ef127 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -188,7 +188,7 @@ def log_audit(linkinfo, action, message, user_id = None):
def confirm_all_local_changes():
- site_id = our_site_id()
+ site_id = config.omd_site()
repl_status = load_replication_status(lock=True)
try:
@@ -3155,8 +3155,6 @@ def get_login_secret(create_on_demand = False):
# Returns the ID of our site. This function only works in replication
# mode and looks for an entry connecting to the local socket.
def our_site_id():
- if not is_distributed():
- return None
for site_id in config.allsites():
if config.site_is_local(site_id):
return site_id
@@ -3641,7 +3639,7 @@ def verify_slave_site_config(site_id):
if not site_id:
raise MKGeneralException(_("Missing variable siteid"))
- our_id = our_site_id()
+ our_id = config.omd_site()
if not config.is_single_local_site():
raise MKGeneralException(_("Configuration error. You treat us as "