This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 51c604f Issue 50818 - dsconf pwdpolicy get error
51c604f is described below
commit 51c604fe6aadcfe3e7cb592906838dd68c4f62ab
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Mon Jan 13 19:17:04 2020 -0500
Issue 50818 - dsconf pwdpolicy get error
Description: When trying to retrieve a global or local policy we now see:
policyError: 'PwPolicyManager' object has no attribute
'get_attr_list'
Someone removed the function get_attr_list() along the way.
Added the same logic back, and improved it to only report attributes
that are set.
relates:
https://pagure.io/389-ds-base/issue/50818
Reviewed by: spichugi(Thanks!)
---
src/lib389/lib389/cli_conf/pwpolicy.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/lib389/lib389/cli_conf/pwpolicy.py
b/src/lib389/lib389/cli_conf/pwpolicy.py
index f911997..67bfd87 100644
--- a/src/lib389/lib389/cli_conf/pwpolicy.py
+++ b/src/lib389/lib389/cli_conf/pwpolicy.py
@@ -35,16 +35,17 @@ def _get_policy_type(inst, dn=None):
def _get_pw_policy(inst, targetdn, log, use_json=None):
pwp_manager = PwPolicyManager(inst)
policy_type = _get_policy_type(inst, targetdn)
- attr_list = pwp_manager.get_attr_list()
+ attr_list = list(pwp_manager.arg_to_attr.values())
if "global" in policy_type.lower():
targetdn = 'cn=config'
attr_list.extend(['passwordIsGlobalPolicy',
'nsslapd-pwpolicy_local'])
- attrs = inst.config.get_attrs_vals_utf8(attr_list)
+ all_attrs = inst.config.get_attrs_vals_utf8(attr_list)
+ attrs = {k: v for k, v in all_attrs.items() if len(v) > 0}
else:
policy = pwp_manager.get_pwpolicy_entry(targetdn)
targetdn = policy.dn
- attrs = policy.get_attrs_vals_utf8(attr_list)
-
+ all_attrs = policy.get_attrs_vals_utf8(attr_list)
+ attrs = {k: v for k, v in all_attrs.items() if len(v) > 0}
if use_json:
print(json.dumps({"type": "entry", "pwp_type":
policy_type, "dn": ensure_str(targetdn), "attrs": attrs}))
else:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.