Backport two more fixes from upstream

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-01-16 20:50:47 +00:00
parent 604ea19cf8
commit a2478bfa8c
3 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 4f9aafca9a9927812da5e37ce71d79d1fd23b25a Mon Sep 17 00:00:00 2001
From: Matus Honek <mhonek@redhat.com>
Date: Thu, 16 Jan 2020 12:21:45 +0100
Subject: [PATCH 1/2] Issue 50824 - dsctl remove fails with "name 'ensure_str'
is not defined"
Bug Description:
Missing import since commit c39c7bb.
Fix Description:
Add the import.
Fixes https://pagure.io/389-ds-base/issue/50824
Author: Matus Honek <mhonek@redhat.com>
Review by: Mark (thanks!)
---
src/lib389/lib389/instance/remove.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib389/lib389/instance/remove.py b/src/lib389/lib389/instance/remove.py
index e54e64e5c..e48b294df 100644
--- a/src/lib389/lib389/instance/remove.py
+++ b/src/lib389/lib389/instance/remove.py
@@ -11,7 +11,7 @@ import shutil
import subprocess
import logging
from lib389.nss_ssl import NssSsl
-from lib389.utils import selinux_label_port, assert_c, ensure_list_str
+from lib389.utils import selinux_label_port, assert_c, ensure_str, ensure_list_str
######################## WARNING #############################
--
2.24.1

View File

@ -0,0 +1,49 @@
From 2a6784884fa931643f52ff01dc7dacf3da0be90f Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 13 Jan 2020 19:17:04 -0500
Subject: [PATCH 2/2] 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 f911997bf..67bfd8767 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:
--
2.24.1

View File

@ -45,7 +45,7 @@ ExcludeArch: i686
Summary: 389 Directory Server (base)
Name: 389-ds-base
Version: 1.4.3.1
Release: %{?relprefix}2%{?prerel}%{?dist}
Release: %{?relprefix}3%{?prerel}%{?dist}
License: GPLv3+
URL: https://www.port389.org
Conflicts: selinux-policy-base < 3.9.8
@ -175,6 +175,12 @@ Source3: https://github.com/jemalloc/%{jemalloc_name}/releases/download
# Backport of https://pagure.io/389-ds-base/c/828aad0
# Fixes a missing import that broke FreeIPA deployment
Patch0: 0001-Issue-50798-incorrect-bytes-in-format-string-fix-imp.patch
# https://pagure.io/389-ds-base/c/4f9aafc
# Fixes another missing import
Patch1: 0001-Issue-50824-dsctl-remove-fails-with-name-ensure_str-.patch
# https://pagure.io/389-ds-base/c/2a67848
# Fixes a removed function
Patch2: 0002-Issue-50818-dsconf-pwdpolicy-get-error.patch
%description
389 Directory Server is an LDAPv3 compliant server. The base package includes
@ -298,6 +304,8 @@ A cockpit UI Plugin for configuring and administering the 389 Directory Server
%prep
%setup -q -n %{name}-%{version}%{?prerel}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%if %{bundle_jemalloc}
%setup -q -n %{name}-%{version}%{?prerel} -T -D -b 3
@ -770,6 +778,9 @@ exit 0
%doc README.md
%changelog
* Thu Jan 16 2020 Adam Williamson <awilliam@redhat.com> - 1.4.3.1-3
- Backport two more import/missing function fixes
* Wed Jan 15 2020 Adam Williamson <awilliam@redhat.com> - 1.4.3.1-2
- Backport 828aad0 to fix missing imports from 1.4.3.1