Module: check_mk
Branch: master
Commit: d7332b1053403a089a9e342ee241d51322a4da4e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d7332b1053403a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 30 13:35:00 2017 +0200
5056 FIX WATO: Wrong list of groups shown on user edit page when syncing groups via LDAP
The locked contact group list on the edit user page was listing too many groups when
using the contact group plugin of the LDAP sync.
Change-Id: I17c0253b1805f1f87c4155c6a6f600ac16e546fe
---
.werks/5056 | 12 ++++++++++++
web/htdocs/wato.py | 13 ++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/.werks/5056 b/.werks/5056
new file mode 100644
index 0000000..dfcb0d8
--- /dev/null
+++ b/.werks/5056
@@ -0,0 +1,12 @@
+Title: WATO: Wrong list of groups shown on user edit page when syncing groups via LDAP
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1504092814
+
+The locked contact group list on the edit user page was listing too many groups when
+using the contact group plugin of the LDAP sync.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index dead87c..6e0f953 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11024,23 +11024,22 @@ def mode_edit_user(phase):
html.write(_("Please first create some <a href='%s'>contact groups</a>") %
groups_page_url)
else:
- entries = sorted([ (group['alias'], c) for c, group in contact_groups.items() ])
+ entries = sorted([ (group['alias'] or c, c) for c, group in contact_groups.items() ])
is_member_of_at_least_one = False
for alias, gid in entries:
- if not alias:
- alias = gid
+ is_member = gid in user.get("contactgroups", [])
if not is_locked('contactgroups'):
html.checkbox("cg_" + gid, gid in user.get("contactgroups", []))
else:
- is_member = gid in user.get("contactgroups", [])
if is_member:
is_member_of_at_least_one = True
html.hidden_field("cg_" + gid, '1' if is_member else '')
- url = folder_preserving_link([("mode", "edit_contact_group"), ("edit", gid)])
- html.a(alias, href=url)
- html.br()
+ if not is_locked('contactgroups') or is_member:
+ url = folder_preserving_link([("mode", "edit_contact_group"), ("edit", gid)])
+ html.a(alias, href=url)
+ html.br()
if is_locked('contactgroups') and not is_member_of_at_least_one:
html.i(_('No contact groups assigned.'))
Module: check_mk
Branch: master
Commit: add5a67c362add556cc4db9aebda96b51d27c47d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=add5a67c362add…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 30 11:04:27 2017 +0200
test_automation_try_discovery_not_existing_host: Use another hostname for the test
Change-Id: If573c54176a1ef8b76d3c343ebb40645783b0a76
---
tests/cmk_base/test_automations.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/cmk_base/test_automations.py b/tests/cmk_base/test_automations.py
index 720b245..2abcf21 100644
--- a/tests/cmk_base/test_automations.py
+++ b/tests/cmk_base/test_automations.py
@@ -236,8 +236,8 @@ def test_automation_analyse_service_no_check(test_cfg, site):
def test_automation_try_discovery_not_existing_host(test_cfg, site):
data = _execute_automation(site, "try-inventory",
- args=["x"],
- expect_stderr="Failed to lookup IPv4 address of x via DNS: [Errno -2] Name or service not known\n\n",
+ args=["xxx-not-existing-host"],
+ expect_stderr="Failed to lookup IPv4 address of xxx-not-existing-host via DNS: [Errno -2] Name or service not known\n\n",
expect_stdout="",
expect_exit_code=2,
parse_data=False,
Module: check_mk
Branch: master
Commit: 03582d6d36bd7fc669f463905cf9e8b5500b935c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=03582d6d36bd7f…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Aug 29 18:28:04 2017 +0200
df.include: Split up df_inventory a bit
We extract the logic sorting a mountpoint list into ungrouped mountpoints
and groups.
Change-Id: I51805782abe9ca590d8d2f91a274200c2769698e
---
checks/df.include | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/checks/df.include b/checks/df.include
index a024689..f62d8ae 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -66,32 +66,34 @@ factory_settings["filesystem_default_levels"] = {
"show_reserved" : False,
}
-def df_inventory(mplist):
- group_patterns = {}
- for line in host_extra_conf(host_name(), filesystem_groups):
- for group_name, pattern in line:
- group_patterns.setdefault(group_name, []).append(pattern)
- # Create one service for each mount point that is not contained
- # in a filesystem group. And create one service for each non-empty
- # filesystem group.
- inventory = []
- have_groups = set([])
+def ungrouped_mountpoints_and_groups(mplist, group_patterns):
+ ungrouped_mountpoints = []
+ groups = set([])
+
for mp in mplist:
in_group = False
for group_name, patterns in group_patterns.items():
for pattern in patterns:
if fnmatch.fnmatch(mp, pattern):
- have_groups.add(group_name)
+ groups.add(group_name)
in_group = True
break
if not in_group:
- inventory.append((mp, {}))
+ ungrouped_mountpoints.append((mp, {}))
+
+ return ungrouped_mountpoints, groups
+
+
+def df_inventory(mplist):
+ group_patterns = {}
+ for line in host_extra_conf(host_name(), filesystem_groups):
+ for group_name, pattern in line:
+ group_patterns.setdefault(group_name, []).append(pattern)
- for group_name in have_groups:
- inventory.append((group_name, { "patterns" : group_patterns[group_name] }))
+ ungrouped_mountpoints, groups = ungrouped_mountpoints_and_groups(mplist, group_patterns)
- return inventory
+ return ungrouped_mountpoints + list(groups)
# Users might have set filesystem_default_levels to old format like (80, 90)