On 10/31/2016 05:23 PM, Alexander Bokovoy wrote:
See description. This is a regression since FreeIPA 4.4.0.




Hi Alexander,

Please link upstream ticket[1] to the commit message, not BZ.

I have put on my Travis hat and found:

1.) pep8 error:

./ipaserver/plugins/trust.py:1623:25: E128 continuation line under-indented for visual indent

I know that this is a piece of code that was only moved around but it should conform to pep8 anyway.

2.) unused variable:

Pylint is running, please wait ...
************* Module ipaserver.plugins.trust
ipaserver/plugins/trust.py:1619: [W0612(unused-variable), trustdomain_del.execute] Unused variable 'entry')
Makefile:130: recipe for target 'pylint' failed
make: *** [pylint] Error 1

Also, if you just want to check if the domain exists, I think that you can use `get_dn_if_exists` method of LDAPObject (you will get rid of unused variable as a bonus):

diff --git a/ipaserver/plugins/trust.py b/ipaserver/plugins/trust.py
index 3540742..2cd4722 100644
--- a/ipaserver/plugins/trust.py
+++ b/ipaserver/plugins/trust.py
@@ -1615,8 +1615,7 @@ class trustdomain_del(LDAPDelete):

         for domain in keys[1]:
             try:
-                dn = self.obj.get_dn(keys[0], domain, trust_type=u'ad')
-                entry = ldap.get_entry(dn)
+ self.obj.get_dn_if_exists(keys[0], domain, trust_type=u'ad')
             except errors.NotFound:
                 if keys[0].lower() == domain:
                     raise errors.ValidationError(name='domain'

[1] https://fedorahosted.org/freeipa/ticket/6445

--
Martin^3 Babinsky

--
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

Reply via email to