From 49810b5043d883ae5127d580914fd14c54a103d8 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Tue, 3 Sep 2019 13:50:47 +0200
Subject: [PATCH 1/3] Enable literal-comparison linter again

The literal comparison linter checks for "value is 0" or "value is ''".

Related: https://pagure.io/freeipa/issue/8057
Signed-off-by: Christian Heimes <cheimes@redhat.com>
---
 pylintrc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pylintrc b/pylintrc
index 7b2530813b..741e52d26b 100644
--- a/pylintrc
+++ b/pylintrc
@@ -92,7 +92,6 @@ disable=
     singleton-comparison,
     len-as-condition,  # new in pylint 1.7
     no-else-return,  # new in pylint 1.7
-    literal-comparison,  # new in pylint 1.7
     single-string-used-for-slots,  # new in pylint 1.7
     useless-super-delegation,  # new in pylint 1.7
     redefined-argument-from-local,  # new in pylint 1.7

From 5a123d777d9a46bb811af8371226d89ebb9e630a Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Tue, 3 Sep 2019 13:55:27 +0200
Subject: [PATCH 2/3] Fix wrong use of identity operation

Strings should not be compared with the identity operation 'is' or
'is not'.

Fixes: https://pagure.io/freeipa/issue/8057
Signed-off-by: Christian Heimes <cheimes@redhat.com>
---
 ipatests/test_cmdline/test_ipagetkeytab.py  | 2 +-
 ipatests/test_ipalib/test_text.py           | 4 ++--
 ipatests/test_ipaserver/test_ldap.py        | 2 +-
 ipatests/test_xmlrpc/test_certmap_plugin.py | 2 +-
 ipatests/test_xmlrpc/tracker/user_plugin.py | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ipatests/test_cmdline/test_ipagetkeytab.py b/ipatests/test_cmdline/test_ipagetkeytab.py
index 7c613dfc5c..f89bfaba6f 100644
--- a/ipatests/test_cmdline/test_ipagetkeytab.py
+++ b/ipatests/test_cmdline/test_ipagetkeytab.py
@@ -465,4 +465,4 @@ def test_use(self, test_smb_svc):
         entry = conn.retrieve(test_smb_svc.dn, ['ipaNTHash'])
         ipanthash = entry.single_value.get('ipanthash')
         conn.disconnect()
-        assert ipanthash is not b'MagicRegen', 'LDBM backend entry corruption'
+        assert ipanthash != b'MagicRegen', 'LDBM backend entry corruption'
diff --git a/ipatests/test_ipalib/test_text.py b/ipatests/test_ipalib/test_text.py
index bcbca5090c..f25f795c5a 100644
--- a/ipatests/test_ipalib/test_text.py
+++ b/ipatests/test_ipalib/test_text.py
@@ -187,7 +187,7 @@ def test_init(self):
         inst = self.klass('what up?', 'foo', 'bar')
         assert inst.domain == 'foo'
         assert inst.localedir == 'bar'
-        assert inst.msg is 'what up?'
+        assert inst.msg == 'what up?'
         assert inst.args == ('what up?', 'foo', 'bar')
 
     def test_repr(self):
@@ -349,7 +349,7 @@ def test_call(self):
         inst = self.klass('foo', 'bar')
         g = inst('what up?')
         assert type(g) is text.Gettext
-        assert g.msg is 'what up?'
+        assert g.msg == 'what up?'
         assert g.domain == 'foo'
         assert g.localedir == 'bar'
 
diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py
index ec23bd37e1..613007118e 100644
--- a/ipatests/test_ipaserver/test_ldap.py
+++ b/ipatests/test_ipaserver/test_ldap.py
@@ -233,7 +233,7 @@ def test_pop(self):
         e = self.entry
         assert e.pop('cn') == self.cn1
         assert 'cn' not in e
-        assert e.pop('cn', 'default') is 'default'
+        assert e.pop('cn', 'default') == 'default'
         with pytest.raises(KeyError):
             e.pop('cn')
 
diff --git a/ipatests/test_xmlrpc/test_certmap_plugin.py b/ipatests/test_xmlrpc/test_certmap_plugin.py
index 348d85efcb..ce88ced4ef 100644
--- a/ipatests/test_xmlrpc/test_certmap_plugin.py
+++ b/ipatests/test_xmlrpc/test_certmap_plugin.py
@@ -451,7 +451,7 @@ def test_find(self, certmap_rule, certmap_user_permissions):
         ) as ewe:
             find = certmap_rule.make_find_command()
             res = find(**{k: v for k, v in certmaprule_create_params.items()
-                          if k is not u'dn'})
+                          if k != u'dn'})
             ewe.send(res)
 
     def test_update(self, certmap_rule, certmap_user_permissions):
diff --git a/ipatests/test_xmlrpc/tracker/user_plugin.py b/ipatests/test_xmlrpc/tracker/user_plugin.py
index fa3957e05b..d5d510a61b 100644
--- a/ipatests/test_xmlrpc/tracker/user_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/user_plugin.py
@@ -227,7 +227,7 @@ def update(self, updates, expected_updates=None):
         result = command()
 
         for key, value in updates.items():
-            if value is None or value is '' or value is u'':
+            if value is None or value == '':
                 del self.attrs[key]
             elif key == 'rename':
                 new_principal = u'{0}@{1}'.format(value, self.api.env.realm)
@@ -241,7 +241,7 @@ def update(self, updates, expected_updates=None):
                 else:
                     self.attrs[key] = [value]
         for key, value in expected_updates.items():
-            if value is None or value is '' or value is u'':
+            if value is None or value == '':
                 del self.attrs[key]
             else:
                 self.attrs[key] = value

From fcbb7f0d0e0c05028a35b3fa057c7f70af254a09 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Tue, 3 Sep 2019 15:49:57 +0200
Subject: [PATCH 3/3] Add new env vars to pylint plugin

The vars api.env.host_princ and smb_princ where introduced a while ago.
Sometimes parallel linting complain about the attributes. Add both to
the list of known members in pylint_plugins.py.

Related: https://pagure.io/freeipa/issue/3999
Signed-off-by: Christian Heimes <cheimes@redhat.com>
---
 pylint_plugins.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index 6e7526f8e8..503121c4f2 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -499,6 +499,7 @@ def wildcard(*args, **kwargs):
     api.env.force_schema_check = False
     api.env.home = ''  # object
     api.env.host = ''
+    api.env.host_princ = ''
     api.env.http_timeout = 0
     api.env.in_server = False  # object
     api.env.in_tree = False  # object
@@ -524,6 +525,7 @@ def wildcard(*args, **kwargs):
     api.env.script = ''  # object
     api.env.site_packages = ''  # object
     api.env.skip_version_check = False
+    api.env.smb_princ = ''
     api.env.startup_timeout = 0
     api.env.startup_traceback = False
     api.env.tls_ca_cert = ''  # object
