From e8d33ccfd16dc82cfe383bb36eb15db60dafb19d Mon Sep 17 00:00:00 2001 From: Armando Neto Date: Tue, 3 Jul 2018 17:12:07 -0300 Subject: [PATCH] ipa-server-install: fix zonemgr argument validator Fix `ERROR 'str' object has no attribute 'decode'` when --zonemgr is passed to ipa-server-install. Solution copied from commit 75d26e1f0121f875bdb017b0636c02a6f5660e8a, function `ipaserver.install.bindinstance.zonemgr_callback` duplicates the behavior of the method affected by this patch. Issue: https://pagure.io/freeipa/issue/7612 Signed-off-by: Armando Neto Reviewed-By: Rob Crittenden Reviewed-By: Christian Heimes --- ipaserver/install/dns.py | 6 +++++- ipatests/test_integration/test_installation.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ipaserver/install/dns.py b/ipaserver/install/dns.py index 40a3c0b49..61b4a851e 100644 --- a/ipaserver/install/dns.py +++ b/ipaserver/install/dns.py @@ -476,7 +476,11 @@ class DNSInstallInterface(hostname.HostNameInstallInterface): encoding = getattr(sys.stdin, 'encoding', None) if encoding is None: encoding = 'utf-8' - value = value.decode(encoding) + + # value is string in py2 and py3 + if not isinstance(value, unicode): + value = value.decode(encoding) + bindinstance.validate_zonemgr_str(value) except ValueError as e: # FIXME we can do this in better way diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index ad45f5811..8a24e32ff 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -410,7 +410,11 @@ class TestInstallMasterDNS(IntegrationTest): pass def test_install_master(self): - tasks.install_master(self.master, setup_dns=True) + tasks.install_master( + self.master, + setup_dns=True, + extra_args=['--zonemgr', 'me@example.org'], + ) def test_install_kra(self): tasks.install_kra(self.master, first_instance=True)