Module: check_mk
Branch: master
Commit: d21aa938431d00e66c65de7c7d205fd7c6028eba
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d21aa938431d00…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 30 16:36:29 2017 +0100
Site specific global settings: First small cleanups and made edit dialog available for master site
Change-Id: Idcf4740543d3b9f9190a809688db788009120353
---
web/htdocs/wato.py | 57 ++++++++++++++++++++++++++++++---------------------
web/htdocs/watolib.py | 2 +-
2 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 03926c1..8c746d6 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9140,24 +9140,24 @@ def mode_sites(phase):
"sites, please do not forget to add your local monitoring site also, if "
"you want to display its data."))
- entries = configured_sites.items()
- sort_sites(entries)
- for id, site in entries:
+ sites = sort_sites(configured_sites.items())
+ for site_id, site in sites:
table.row()
+
# Buttons
- edit_url = folder_preserving_link([("mode", "edit_site"), ("edit", id)])
- clone_url = folder_preserving_link([("mode", "edit_site"), ("clone", id)])
- delete_url = html.makeactionuri([("_delete", id)])
+ edit_url = folder_preserving_link([("mode", "edit_site"), ("edit", site_id)])
+ clone_url = folder_preserving_link([("mode", "edit_site"), ("clone", site_id)])
+ delete_url = html.makeactionuri([("_delete", site_id)])
table.cell(_("Actions"), css="buttons")
html.icon_button(edit_url, _("Properties"), "edit")
html.icon_button(clone_url, _("Clone this connection in order to create a new one"), "clone")
html.icon_button(delete_url, _("Delete"), "delete")
- if site.get("replication"):
- globals_url = folder_preserving_link([("mode", "edit_site_globals"), ("site", id)])
- html.icon_button(globals_url, _("Site-specific global configuration"), "configuration")
+ if has_wato_slave_sites() and (site.get("replication") or config.site_is_local(site_id)):
+ globals_url = folder_preserving_link([("mode", "edit_site_globals"), ("site", site_id)])
+ html.icon_button(globals_url, _("Site specific global configuration"), "configuration")
# Site-ID
- table.cell(_("ID"), id)
+ table.cell(_("ID"), site_id)
# Alias
table.cell(_("Alias"), site.get("alias", ""))
@@ -9212,28 +9212,34 @@ def mode_sites(phase):
table.cell(_("Login"))
if repl:
if site.get("secret"):
- logout_url = make_action_link([("mode", "sites"), ("_logout", id)])
+ logout_url = make_action_link([("mode", "sites"), ("_logout", site_id)])
html.buttonlink(logout_url, _("Logout"))
else:
- login_url = make_action_link([("mode", "sites"), ("_login", id)])
+ login_url = make_action_link([("mode", "sites"), ("_login", site_id)])
html.buttonlink(login_url, _("Login"))
table.end()
+
def mode_edit_site_globals(phase):
configured_sites = load_sites()
- siteid = html.var("site")
- site = configured_sites[siteid]
+ site_id = html.var("site")
+
+ try:
+ site = configured_sites[site_id]
+ except KeyError:
+ raise MKUserError("site", _("This site does not exist."))
search = get_search_expression()
if phase == "title":
- return _("Edit site-specific global settings of %s") % siteid
+ return _("Edit site specific global settings of %s") % site_id
elif phase == "buttons":
+ global_buttons()
html.context_button(_("All Sites"), folder_preserving_link([("mode", "sites")]), "back")
html.context_button(_("Connection"), folder_preserving_link([("mode", "edit_site"),
- ("edit", siteid)]), "sites")
+ ("edit", site_id)]), "sites")
return
# The site's default values are the current global settings
@@ -9250,7 +9256,7 @@ def mode_edit_site_globals(phase):
if action == "reset" and not is_a_checkbox(valuespec):
c = wato_confirm(
- _("Removing site-specific configuration variable"),
+ _("Removing site specific configuration variable"),
_("Do you really want to remove the configuration variable <b>%s</b> "
"of the specific configuration of this site and that way use the global value "
"of <b><tt>%s</tt></b>?") %
@@ -9265,12 +9271,12 @@ def mode_edit_site_globals(phase):
current_settings[varname] = not current_settings[varname]
else:
current_settings[varname] = not def_value
- msg = _("Changed site-specific configuration variable %s to %s.") % (varname,
+ msg = _("Changed site specific configuration variable %s to %s.") % (varname,
current_settings[varname] and _("on") or _("off"))
site.setdefault("globals", {})[varname] = current_settings[varname]
save_sites(configured_sites, activate=False)
- add_change("edit-configvar", msg, sites=[siteid], need_restart=need_restart)
+ add_change("edit-configvar", msg, sites=[site_id], need_restart=need_restart)
if action == "_reset":
return "edit_site_globals", msg
else:
@@ -9284,11 +9290,16 @@ def mode_edit_site_globals(phase):
return
html.help(_("Here you can configure global settings, that should just be applied "
- "on that remote site. <b>Note</b>: this only makes sense if the site "
- "is a configuration slave."))
+ "on that site. <b>Note</b>: this only makes sense if the site "
+ "is part of a distributed setup."))
+
+ if not has_wato_slave_sites():
+ html.show_error(_("You can not configure site specific global settings "
+ "in non distributed setups."))
+ return
- if site.get("replication") != "slave":
- html.show_error(_("This site is not a replication slave. "
+ if not site.get("replication") and not config.site_is_local(site_id):
+ html.show_error(_("This site is not the master site nor a replication slave. "
"You cannot configure specific settings for it."))
return
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 1d96bfe..86d5d86 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -4207,7 +4207,7 @@ class ActivateChangesManager(ActivateChanges):
"userdb_automatic_sync" : site.get("user_sync", userdb.user_sync_default_config(site_id)),
})
- file(tmp_dir + "/sitespecific.mk", "w").write("%r\n" % config)
+ store.save_data_to_file(tmp_dir + "/sitespecific.mk", config)
Module: check_mk
Branch: master
Commit: 45d942cf33bd4f787e7c85ae91eb7ef7f2b56666
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=45d942cf33bd4f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 6 13:01:05 2017 +0100
4321 FIX LDAP: Improved validation of groups to attributes sync plugin
Change-Id: I70db5dbfef6014cc51537569eb25e2d68a52d227
---
.werks/4321 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 11 +++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/4321 b/.werks/4321
new file mode 100644
index 0000000..e3d3063
--- /dev/null
+++ b/.werks/4321
@@ -0,0 +1,10 @@
+Title: LDAP: Improved validation of groups to attributes sync plugin
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1486382449
+
+
diff --git a/ChangeLog b/ChangeLog
index 4a8e9fc..f4aec0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,7 @@
* 4015 FIX: Multisite events page: Fixed slow page generation caused by the event delete icon...
* 4315 FIX: Logwatch problematic logfiles list was showing too many logfiles
* 4316 FIX: Views: Fixed editing of "hide from sidebar" and "show context button" options
+ * 4321 FIX: LDAP: Improved validation of groups to attributes sync plugin
WATO:
* 4142 New extended search dialog for rulesets and rules...
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 5c10d00..842b886 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -1193,9 +1193,10 @@ def ldap_attribute_plugins_elements(connection_id):
)))
else:
elements.append((key, Dictionary(
- title = plugin['title'],
- help = plugin['help'],
- elements = plugin['parameters'],
+ title = plugin['title'],
+ help = plugin['help'],
+ elements = plugin['parameters'],
+ required_keys = plugin.get('required_parameters', []),
)))
return elements
@@ -1648,8 +1649,10 @@ ldap_attribute_plugins['groups_to_attributes'] = {
"not a member of a group, the attribute will be left at it's default value. When "
"a single attribute is set by multiple groups and a user is member of multiple "
"of these groups, the later plugin in the list will override the others."),
+ allow_empty=False,
)),
- ]
+ ],
+ 'required_parameters': ["groups"],
}
#.
Module: check_mk
Branch: master
Commit: df0dfe030899852bd3cc32c0495df80f66294cfd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=df0dfe03089985…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 6 11:03:44 2017 +0100
4320 Distributed: Master site has now also site specific global settings
It is now possible to configure site specific global settings for the central
master site in distributed setups. In previous versions it was difficult to
set a configuration setting (like the number of check helpers) for the master
site and another value for the remote sites. You had to set the configuration
setting for each site individually which could be a problem when having a lot
of remote sites.
With this change the "Global settings" can now be handled as default
configuration settings for all sites while the site specific settings can be
configured on the site specific globals page which can be opened from the
distributed configuration page.
So you can now easily set a individual setting for the master site and leave
the configuration for the slave sites at the global defaults.
Change-Id: Iec7d943263bd6b800f5f31c27232894f4fc7043a
---
.werks/4320 | 22 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/multitar.py | 28 +++++++++++++++-----
web/htdocs/wato.py | 12 +++++----
web/htdocs/watolib.py | 71 +++++++++++++++++++++++++++++++++-----------------
5 files changed, 99 insertions(+), 35 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=df0dfe0308…