On 2015-07-13 16:29, Alexander Bokovoy wrote: >> I will push&mark the commit there. > Please do not push this specific version of the patch yet. Christian > will do the changes with four separate commits as discussed on the IRC, > to avoid future problems with maintenance and backports.
Alex, please have a look at the patches. I have split the patch into four files, one for every file. Is that right? Christian
From 995001a2960da3482300791baa4a8cbf5b325fc7 Mon Sep 17 00:00:00 2001 From: Christian Heimes <[email protected]> Date: Tue, 14 Jul 2015 10:49:39 +0200 Subject: [PATCH 07/10] Remove tuple unpacking from except clause contrib/RHEL4/ipachangeconf.py Python 3 doesn't support tuple unpacking in except clauses. All implicit tuple unpackings have been replaced with explicit unpacking of e.args. https://fedorahosted.org/freeipa/ticket/5120 --- contrib/RHEL4/ipachangeconf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/RHEL4/ipachangeconf.py b/contrib/RHEL4/ipachangeconf.py index 1a361513558f20d65ac8cbb0044e7b8d352e6bad..87b306f5dff336f80b1d02909433253f148108a6 100644 --- a/contrib/RHEL4/ipachangeconf.py +++ b/contrib/RHEL4/ipachangeconf.py @@ -29,13 +29,13 @@ def openLocked(filename, perms): fd = os.open(filename, os.O_RDWR | os.O_CREAT, perms) fcntl.lockf(fd, fcntl.LOCK_EX) - except OSError, (errno, strerr): + except OSError as e: if fd != -1: try: os.close(fd) except OSError: pass - raise IOError(errno, strerr) + raise IOError(e.errno, e.strerror) return os.fdopen(fd, "r+") -- 2.4.3
From 8898e4762b908a10fee3bc4d33071b827c7e8175 Mon Sep 17 00:00:00 2001 From: Christian Heimes <[email protected]> Date: Tue, 14 Jul 2015 10:50:04 +0200 Subject: [PATCH 08/10] Remove tuple unpacking from except clause ipa-client/ipaclient/ipachangeconf.py Python 3 doesn't support tuple unpacking in except clauses. All implicit tuple unpackings have been replaced with explicit unpacking of e.args. https://fedorahosted.org/freeipa/ticket/5120 --- ipa-client/ipaclient/ipachangeconf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipa-client/ipaclient/ipachangeconf.py b/ipa-client/ipaclient/ipachangeconf.py index 15d41274f7a99550b0a49314fb949402e65ee1d1..edf34f5ae738eb22b8935c222392dc9b6f08638d 100644 --- a/ipa-client/ipaclient/ipachangeconf.py +++ b/ipa-client/ipaclient/ipachangeconf.py @@ -31,13 +31,13 @@ def openLocked(filename, perms): fd = os.open(filename, os.O_RDWR | os.O_CREAT, perms) fcntl.lockf(fd, fcntl.LOCK_EX) - except OSError, (errno, strerr): + except OSError as e: if fd != -1: try: os.close(fd) except OSError: pass - raise IOError(errno, strerr) + raise IOError(e.errno, e.strerror) return os.fdopen(fd, "r+") -- 2.4.3
From 1d5f4d9bb77b1dc983244f45e560a98c90697f19 Mon Sep 17 00:00:00 2001 From: Christian Heimes <[email protected]> Date: Tue, 14 Jul 2015 10:50:18 +0200 Subject: [PATCH 09/10] Remove tuple unpacking from except clause ipalib/plugins/hbactest.py Python 3 doesn't support tuple unpacking in except clauses. All implicit tuple unpackings have been replaced with explicit unpacking of e.args. https://fedorahosted.org/freeipa/ticket/5120 --- ipalib/plugins/hbactest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipalib/plugins/hbactest.py b/ipalib/plugins/hbactest.py index 068190310bf14d068620bc4a86d1c48ae1437251..c8dedd367e78cbe900b716369f8ef78575a21298 100644 --- a/ipalib/plugins/hbactest.py +++ b/ipalib/plugins/hbactest.py @@ -462,13 +462,14 @@ class hbactest(Command): matched_rules.append(ipa_rule.name) if res == pyhbac.HBAC_EVAL_DENY: notmatched_rules.append(ipa_rule.name) - except pyhbac.HbacError as (code, rule_name): + except pyhbac.HbacError as e: + code, rule_name = e.args if code == pyhbac.HBAC_EVAL_ERROR: error_rules.append(rule_name) self.log.info('Native IPA HBAC rule "%s" parsing error: %s' % \ (rule_name, pyhbac.hbac_result_string(code))) - except (TypeError, IOError) as (info): - self.log.error('Native IPA HBAC module error: %s' % (info)) + except (TypeError, IOError) as info: + self.log.error('Native IPA HBAC module error: %s' % info) access_granted = len(matched_rules) > 0 else: -- 2.4.3
From 6b5b5f4d868c0a181f9465a45efc31030a89b027 Mon Sep 17 00:00:00 2001 From: Christian Heimes <[email protected]> Date: Tue, 14 Jul 2015 10:50:34 +0200 Subject: [PATCH 10/10] Remove tuple unpacking from except clause ipaserver/dcerpc.py Python 3 doesn't support tuple unpacking in except clauses. All implicit tuple unpackings have been replaced with explicit unpacking of e.args. https://fedorahosted.org/freeipa/ticket/5120 --- ipaserver/dcerpc.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index a1da0a641064f59a79639d97489ff73181787a4a..4de5afb540e880e8948749c2cfa9a019eb807c47 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -772,7 +772,8 @@ class TrustDomainInstance(object): try: result = lsa.lsarpc(binding, self.parm, self.creds) return result - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args raise assess_dcerpc_exception(num=num, message=message) def init_lsa_pipe(self, remote_host): @@ -889,7 +890,8 @@ class TrustDomainInstance(object): try: self._policy_handle = self._pipe.OpenPolicy2(u"", objectAttribute, security.SEC_FLAG_MAXIMUM_ALLOWED) result = self._pipe.QueryInfoPolicy2(self._policy_handle, lsa.LSA_POLICY_INFO_DNS) - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args raise assess_dcerpc_exception(num=num, message=message) self.info['name'] = unicode(result.name.string) @@ -901,7 +903,8 @@ class TrustDomainInstance(object): try: result = self._pipe.QueryInfoPolicy2(self._policy_handle, lsa.LSA_POLICY_INFO_ROLE) - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args raise assess_dcerpc_exception(num=num, message=message) self.info['is_pdc'] = (result.role == lsa.LSA_ROLE_PRIMARY) @@ -1030,14 +1033,16 @@ class TrustDomainInstance(object): dname.string = another_domain.info['dns_domain'] res = self._pipe.QueryTrustedDomainInfoByName(self._policy_handle, dname, lsa.LSA_TRUSTED_DOMAIN_INFO_FULL_INFO) self._pipe.DeleteTrustedDomain(self._policy_handle, res.info_ex.sid) - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args # Ignore anything but access denied (NT_STATUS_ACCESS_DENIED) if num == -1073741790: raise access_denied_error try: trustdom_handle = self._pipe.CreateTrustedDomainEx2(self._policy_handle, info, self.auth_info, security.SEC_STD_DELETE) - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args raise assess_dcerpc_exception(num=num, message=message) # We should use proper trustdom handle in order to modify the @@ -1078,7 +1083,8 @@ class TrustDomainInstance(object): data=data ) return result - except RuntimeError, (num, message): + except RuntimeError as e: + num, message = e.args raise assess_dcerpc_exception(num=num, message=message) result = retrieve_netlogon_info_2(None, self, -- 2.4.3
signature.asc
Description: OpenPGP digital signature
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
