URL: https://github.com/freeipa/freeipa/pull/992
Author: stlaz
 Title: #992: Pylint fixes
Action: opened

PR body:
"""
Pylint check on Fedora 26 fails horribly with multitude of errors. This PR 
tries to fix that. Notice that to successfully run `pylint` on Fedora 26 with 
`make lint`, you need to have `python2-pylint` installed.

Fixes: https://pagure.io/freeipa/issue/6874

This PR should also unblock having Travis CI running in F26 container once 
https://bugzilla.redhat.com/show_bug.cgi?id=1483869 is fixed.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/992/head:pr992
git checkout pr992
From 9eeedec1547e94ac6064da450faf69df06e9936b Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:05:22 +0200
Subject: [PATCH 01/13] pylint: fix not-context-manager false positives

threading.Lock() in ipa-replica-conncheck is an alias to
thread.allocate_lock() which creates a LockType object.
This object is an actual context manager but the alias
seems to confuse pylint a bit.

https://pagure.io/freeipa/issue/6874
---
 install/tools/ipa-replica-conncheck | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/install/tools/ipa-replica-conncheck b/install/tools/ipa-replica-conncheck
index 3db2e02cde..0471f047b6 100755
--- a/install/tools/ipa-replica-conncheck
+++ b/install/tools/ipa-replica-conncheck
@@ -318,7 +318,7 @@ class PortResponder(threading.Thread):
             logger.debug('%d %s: Stopped listening', port, proto)
 
     def _is_closing(self):
-        with self._close_lock:
+        with self._close_lock:  # pylint: disable=not-context-manager
             return self._close
 
     def _bind_to_port(self, port, socket_type):
@@ -369,7 +369,7 @@ class PortResponder(threading.Thread):
     def stop(self):
         logger.debug('Stopping listening thread.')
 
-        with self._close_lock:
+        with self._close_lock:  # pylint: disable=not-context-manager
             self._close = True
 
 

From 001d7382b4fbb92c5e426d95ee01ac641e509718 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:10:23 +0200
Subject: [PATCH 02/13] csrgen: fix incorrect codec for pyasn BitString

https://pagure.io/freeipa/issue/6874
---
 ipaclient/csrgen.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipaclient/csrgen.py b/ipaclient/csrgen.py
index ac3d33116b..3f3ea1cde6 100644
--- a/ipaclient/csrgen.py
+++ b/ipaclient/csrgen.py
@@ -12,6 +12,7 @@
 import pipes
 import subprocess
 import traceback
+import codecs
 
 import pkg_resources
 
@@ -438,7 +439,10 @@ def sign_csr(self, certification_request_info):
             padding.PKCS1v15(),
             hashes.SHA256()
         )
-        asn1sig = univ.BitString("'%s'H" % signature.encode('hex'))
+        asn1sig = univ.BitString("'{sig}'H".format(
+                                    sig=codecs.encode(signature, 'hex')
+                                    .decode('ascii'))
+                                 )
         csr.setComponentByName('signature', asn1sig)
         return encoder.encode(csr)
 

From 51199ebc4dfeadcdf50ef3d9c62685879f457f88 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:12:26 +0200
Subject: [PATCH 03/13] pylint: fix no-member in schema plugin

The `module.register` member is added just a few lines
before pylint warns there's none such thing.

https://pagure.io/freeipa/issue/6874
---
 ipaclient/remote_plugins/schema.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
index efb479079b..151cd1afe6 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -580,7 +580,7 @@ def get_package(server_info, client):
     for plugin_cls in (_SchemaCommandPlugin, _SchemaObjectPlugin):
         for full_name in schema[plugin_cls.schema_key]:
             plugin = plugin_cls(schema, str(full_name))
-            plugin = module.register()(plugin)
+            plugin = module.register()(plugin)  # pylint: disable=no-member
     sys.modules[module_name] = module
 
     for full_name, topic in six.iteritems(schema['topics']):

From 8b278733ea96102cac40e7765058b8e223a5ec9e Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:19:05 +0200
Subject: [PATCH 04/13] dcerpc: refactor assess_dcerpc_exception

assess_dcerpc_exception was used in multiple places with a pre-step
which was rather common. Move this to one spot.

This also fixes pylint warning about unbalanced unpacking.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/dcerpc.py | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py
index 6de2194fa1..762c32de28 100644
--- a/ipaserver/dcerpc.py
+++ b/ipaserver/dcerpc.py
@@ -162,11 +162,20 @@ class TrustTopologyConflictSolved(Exception):
     """
     pass
 
-def assess_dcerpc_exception(num=None, message=None):
+
+def assess_dcerpc_error(error):
     """
     Takes error returned by Samba bindings and converts it into
     an IPA error class.
     """
+    if isinstance(error, RuntimeError):
+        error_tuple = error.args
+    else:
+        error_tuple = error
+    if len(error_tuple != 2):
+        raise RuntimeError("Unable to parse error: {err!r}".format(err=error))
+
+    num, message = error_tuple
     if num and num in dcerpc_error_codes:
         return dcerpc_error_codes[num]
     if message and message in dcerpc_error_messages:
@@ -812,8 +821,7 @@ def __retrieve_trusted_domain_gc_list(self, domain):
 
         # Both methods should not fail at the same time
         if finddc_error and len(info['gc']) == 0:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(finddc_error)
 
         self._info[domain] = info
         return info
@@ -846,8 +854,7 @@ def __gen_lsa_connection(self, binding):
             result = lsa.lsarpc(binding, self.parm, self.creds)
             return result
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(e)
 
     def init_lsa_pipe(self, remote_host):
         """
@@ -919,8 +926,7 @@ def retrieve_anonymously(self, remote_host,
             else:
                 result = netrc.finddc(address=remote_host, flags=flags)
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(e)
 
         if not result:
             return False
@@ -973,8 +979,7 @@ def retrieve(self, remote_host):
             result = self._pipe.QueryInfoPolicy2(self._policy_handle,
                                                  lsa.LSA_POLICY_INFO_DNS)
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(e)
 
         self.info['name'] = unicode(result.name.string)
         self.info['dns_domain'] = unicode(result.dns_domain.string)
@@ -987,8 +992,7 @@ def retrieve(self, remote_host):
             result = self._pipe.QueryInfoPolicy2(self._policy_handle,
                                                  lsa.LSA_POLICY_INFO_ROLE)
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(e)
 
         self.info['is_pdc'] = (result.role == lsa.LSA_ROLE_PRIMARY)
 
@@ -1272,8 +1276,7 @@ def establish_trust(self, another_domain, trustdom_secret,
                                            info, self.auth_info,
                                            security.SEC_STD_DELETE)
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
-            raise assess_dcerpc_exception(num=num, message=message)
+            raise assess_dcerpc_error(e)
 
         # We should use proper trustdom handle in order to modify the
         # trust settings. Samba insists this has to be done with LSA
@@ -1339,8 +1342,7 @@ def retrieve_netlogon_info_2(logon_server, domain, function_code, data):
                                            data=data)
                 return result
             except RuntimeError as e:
-                num, message = e.args  # pylint: disable=unpacking-non-sequence
-                raise assess_dcerpc_exception(num=num, message=message)
+                raise assess_dcerpc_error(e)
 
         result = retrieve_netlogon_info_2(None, self,
                                           netlogon.NETLOGON_CONTROL_TC_VERIFY,
@@ -1381,7 +1383,7 @@ def retrieve_netlogon_info_2(logon_server, domain, function_code, data):
 
                     raise errors.ACIError(info=error_message)
 
-                raise assess_dcerpc_exception(*result.pdc_connection_status)
+                raise assess_dcerpc_error(result.pdc_connection_status)
 
             return True
 
@@ -1420,8 +1422,7 @@ def communicate(td):
             result = netrc.finddc(domain=trustdomain,
                                   flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS)
     except RuntimeError as e:
-        num, message = e.args  # pylint: disable=unpacking-non-sequence
-        raise assess_dcerpc_exception(num=num, message=message)
+        raise assess_dcerpc_error(e)
 
     td.info['dc'] = unicode(result.pdc_dns_name)
     td.info['name'] = unicode(result.dns_domain)

From 0c5cdb6f4627549e0201a7508063caeae7dd60a7 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:23:04 +0200
Subject: [PATCH 05/13] dcerpc: disable unbalanced-tuple-unpacking

Disable unbalanced-tuple-unpacking for RuntimeException thrown
by samba since this one should always contain two members.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/dcerpc.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py
index 762c32de28..9f36ed2db2 100644
--- a/ipaserver/dcerpc.py
+++ b/ipaserver/dcerpc.py
@@ -1265,7 +1265,9 @@ def establish_trust(self, another_domain, trustdom_secret,
             self._pipe.DeleteTrustedDomain(self._policy_handle,
                                            res.info_ex.sid)
         except RuntimeError as e:
-            num, message = e.args  # pylint: disable=unpacking-non-sequence
+            # pylint: disable=unbalanced-tuple-unpacking
+            num, _message = e.args
+            # pylint: enable=unbalanced-tuple-unpacking
             # Ignore anything but access denied (NT_STATUS_ACCESS_DENIED)
             if num == -1073741790:
                 raise access_denied_error

From c5f943183bf7f53349aff03b04e1af3a095fb68b Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:26:01 +0200
Subject: [PATCH 06/13] parameters: convert Decimal.precision to int

Explicitly convert Decimal.precision to int for unary `-` to make
sure int is passed to it.

Fixes pylint warning.

https://pagure.io/freeipa/issue/6874
---
 ipalib/parameters.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 462e6e35ee..81586e2c92 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -1227,7 +1227,7 @@ def _enforce_numberclass(self, value):
     def _enforce_precision(self, value):
         assert type(value) is decimal.Decimal
         if self.precision is not None:
-            quantize_exp = decimal.Decimal(10) ** -self.precision
+            quantize_exp = decimal.Decimal(10) ** -int(self.precision)
             try:
                 value = value.quantize(quantize_exp)
             except decimal.DecimalException as e:

From f62f8206cd75850c79515987cc19f73dc36b3251 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 13:57:16 +0200
Subject: [PATCH 07/13] pylint: Iterate through dictionaries

The consider-iterating-dictionary check disable never worked before
(notice the missing comma in pylintrc). Fix the rest of the dict
iteration.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/plugins/dns.py | 4 ++--
 pylintrc                 | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/ipaserver/plugins/dns.py b/ipaserver/plugins/dns.py
index 439e00def7..1d69cede01 100644
--- a/ipaserver/plugins/dns.py
+++ b/ipaserver/plugins/dns.py
@@ -2920,7 +2920,7 @@ def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *args, **option
         if options.get('forward_only', False):
             search_kw = {}
             search_kw['idnsname'] = [revzone.ToASCII() for revzone in
-                                     REVERSE_DNS_ZONES.keys()]
+                                     REVERSE_DNS_ZONES]
             rev_zone_filter = ldap.make_filter(search_kw,
                                                rules=ldap.MATCH_NONE,
                                                exact=False,
@@ -3094,7 +3094,7 @@ def _ptrrecord_pre_callback(self, ldap, dn, entry_attrs, *keys, **options):
 
         if not zone_len:
             allowed_zones = ', '.join([unicode(revzone) for revzone in
-                                       REVERSE_DNS_ZONES.keys()])
+                                       REVERSE_DNS_ZONES])
             raise errors.ValidationError(name='ptrrecord',
                     error=unicode(_('Reverse zone for PTR record should be a sub-zone of one the following fully qualified domains: %s') % allowed_zones))
 
diff --git a/pylintrc b/pylintrc
index 8cb86319eb..d638b459fd 100644
--- a/pylintrc
+++ b/pylintrc
@@ -93,7 +93,6 @@ disable=
     redefined-argument-from-local,  # new in pylint 1.7
     consider-merging-isinstance,  # new in pylint 1.7
     unsupported-assignment-operation  # new in pylint 1.7
-    consider-iterating-dictionary,  # wontfix for better python2/3 code
 
 
 [REPORTS]

From 2557019a2cdb2195c7411b8a9db4bb2b69c44b2f Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:00:07 +0200
Subject: [PATCH 08/13] sudocmd: fix unsupported assignment

sudocmd.get_dn() was trying to assign in an item of a tuple
which is not possible.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/plugins/sudocmd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipaserver/plugins/sudocmd.py b/ipaserver/plugins/sudocmd.py
index a207477238..967f8c7e71 100644
--- a/ipaserver/plugins/sudocmd.py
+++ b/ipaserver/plugins/sudocmd.py
@@ -126,7 +126,7 @@ class sudocmd(LDAPObject):
 
     def get_dn(self, *keys, **options):
         if keys[-1].endswith('.'):
-            keys[-1] = keys[-1][:-1]
+            keys = (keys[:-1] + keys[-1][:-1])
         dn = super(sudocmd, self).get_dn(*keys, **options)
         try:
             self.backend.get_entry(dn, [''])

From 4eac352091579c2860707bb041ec21098407bbef Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:06:22 +0200
Subject: [PATCH 09/13] pylint: make unsupported-assignment-operation check
 local

unsupported-assignment-operation is useful at times, make it only
local, not global.

https://pagure.io/freeipa/issue/6874
---
 ipalib/cli.py                      | 2 ++
 ipalib/config.py                   | 2 ++
 ipaserver/plugins/schema.py        | 2 ++
 ipatests/test_ipapython/test_dn.py | 3 +++
 pylintrc                           | 1 -
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index 3196687f0b..21563befbc 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -999,7 +999,9 @@ def __setattr__(self, name, value):
                 value = v + (value,)
             else:
                 value = (v, value)
+        # pylint: disable=unsupported-assignment-operation
         self.__options[name] = value
+        # pylint: enable=unsupported-assignment-operation
         object.__setattr__(self, name, value)
 
     def __todict__(self):
diff --git a/ipalib/config.py b/ipalib/config.py
index 134772c404..151c4b4a8f 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -273,7 +273,9 @@ def __setitem__(self, key, value):
         if type(value) not in (unicode, int, float, bool, type(None), DN):
             raise TypeError(key, value)
         object.__setattr__(self, key, value)
+        # pylint: disable=unsupported-assignment-operation
         self.__d[key] = value
+        # pylint: enable=unsupported-assignment-operation
 
     def __getitem__(self, key):
         """
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index 8fd7c6ba1c..5c5da671a4 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -377,8 +377,10 @@ def __make_topics(self):
                     'full_name': topic_full_name,
                 }
                 topics.append(topic)
+                # pylint: disable=unsupported-assignment-operation
                 topics_by_key[topic_name] = topic
                 topics_by_key[topic_full_name] = topic
+                # pylint: enable=unsupported-assignment-operation
 
                 for package in self.api.packages:
                     module_name = '.'.join((package.__name__, topic_name))
diff --git a/ipatests/test_ipapython/test_dn.py b/ipatests/test_ipapython/test_dn.py
index 0f004c5817..4dd32366ba 100644
--- a/ipatests/test_ipapython/test_dn.py
+++ b/ipatests/test_ipapython/test_dn.py
@@ -528,6 +528,7 @@ def test_indexing(self):
     def test_assignments(self):
         rdn = RDN((self.attr1, self.value1))
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             rdn[0] = self.ava2
 
     def test_iter(self):
@@ -954,8 +955,10 @@ def test_indexing(self):
     def test_assignments(self):
         dn = DN('t=0,t=1,t=2,t=3,t=4,t=5,t=6,t=7,t=8,t=9')
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             dn[0] = RDN('t=a')
         with self.assertRaises(TypeError):
+            # pylint: disable=unsupported-assignment-operation
             dn[0:1] = [RDN('t=a'), RDN('t=b')]
 
     def test_iter(self):
diff --git a/pylintrc b/pylintrc
index d638b459fd..462b96cb00 100644
--- a/pylintrc
+++ b/pylintrc
@@ -92,7 +92,6 @@ disable=
     useless-super-delegation,  # new in pylint 1.7
     redefined-argument-from-local,  # new in pylint 1.7
     consider-merging-isinstance,  # new in pylint 1.7
-    unsupported-assignment-operation  # new in pylint 1.7
 
 
 [REPORTS]

From 13ae1ebe08f392efd983674adb6d2c6a395a3101 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:08:27 +0200
Subject: [PATCH 10/13] install.util: disable no-value-for-parameter

InnerClassMeta is rather magical and seems to work as-is. There's a
reason not to always send all parameters to the methods since they
really don't have to be able to handle all the parameters all the
time.

https://pagure.io/freeipa/issue/6874
---
 ipapython/install/util.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ipapython/install/util.py b/ipapython/install/util.py
index 4c6bcd5335..1e3d2b164b 100644
--- a/ipapython/install/util.py
+++ b/ipapython/install/util.py
@@ -82,6 +82,7 @@ def run_generator_with_yield_from(gen):
 
 
 class InnerClassMeta(type):
+    # pylint: disable=no-value-for-parameter
     def __new__(mcs, name, bases, class_dict):
         class_dict.pop('__outer_class__', None)
         class_dict.pop('__outer_name__', None)

From a02776e1e66af3bba102acc71c87743041204b1e Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:12:40 +0200
Subject: [PATCH 11/13] pylint: disable eq-without-hash

https://pagure.io/freeipa/issue/6874
---
 pylintrc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pylintrc b/pylintrc
index 462b96cb00..9eb65c0713 100644
--- a/pylintrc
+++ b/pylintrc
@@ -92,6 +92,7 @@ disable=
     useless-super-delegation,  # new in pylint 1.7
     redefined-argument-from-local,  # new in pylint 1.7
     consider-merging-isinstance,  # new in pylint 1.7
+    eq-without-hash,
 
 
 [REPORTS]

From 16cb02f0872284b8a97a70c94d997c186c8ac666 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:14:40 +0200
Subject: [PATCH 12/13] secrets: disable relative-imports for custodia

pylint is somehow confused about us importing custodia in
ipaserver.secrets.* modules, disable the check for these.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/secrets/client.py  | 2 ++
 ipaserver/secrets/kem.py     | 2 ++
 ipaserver/secrets/service.py | 2 +-
 ipaserver/secrets/store.py   | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ipaserver/secrets/client.py b/ipaserver/secrets/client.py
index 3c7a055476..7ab930601f 100644
--- a/ipaserver/secrets/client.py
+++ b/ipaserver/secrets/client.py
@@ -1,7 +1,9 @@
 # Copyright (C) 2015  IPA Project Contributors, see COPYING for license
 
 from __future__ import print_function
+# pylint: disable=relative-import
 from custodia.message.kem import KEMClient, KEY_USAGE_SIG, KEY_USAGE_ENC
+# pylint: enable=relative-import
 from jwcrypto.common import json_decode
 from jwcrypto.jwk import JWK
 from ipaserver.secrets.kem import IPAKEMKeys
diff --git a/ipaserver/secrets/kem.py b/ipaserver/secrets/kem.py
index 3363d82fef..8fecd5bb58 100644
--- a/ipaserver/secrets/kem.py
+++ b/ipaserver/secrets/kem.py
@@ -12,8 +12,10 @@
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import serialization
 from cryptography.hazmat.primitives.asymmetric import rsa, ec
+# pylint: disable=relative-import
 from custodia.message.kem import KEMKeysStore
 from custodia.message.kem import KEY_USAGE_SIG, KEY_USAGE_ENC, KEY_USAGE_MAP
+# pylint: enable=relative-import
 from jwcrypto.common import json_decode, json_encode
 from jwcrypto.common import base64url_encode
 from jwcrypto.jwk import JWK
diff --git a/ipaserver/secrets/service.py b/ipaserver/secrets/service.py
index f51c46a30e..36d5a444e3 100644
--- a/ipaserver/secrets/service.py
+++ b/ipaserver/secrets/service.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2017  IPA Project Contributors, see COPYING for license
 import argparse
 
-import custodia.server
+import custodia.server  # pylint: disable=relative-import
 
 
 argparser = argparse.ArgumentParser(
diff --git a/ipaserver/secrets/store.py b/ipaserver/secrets/store.py
index 87fdc556fd..e741d3311e 100644
--- a/ipaserver/secrets/store.py
+++ b/ipaserver/secrets/store.py
@@ -2,7 +2,7 @@
 
 from __future__ import print_function
 from base64 import b64encode, b64decode
-from custodia.store.interface import CSStore
+from custodia.store.interface import CSStore  # pylint: disable=relative-import
 from jwcrypto.common import json_decode, json_encode
 from ipaplatform.paths import paths
 from ipapython import ipautil

From 9c5cae561e95ab8f35c7726be2b7a332fa747d26 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 22 Aug 2017 14:21:30 +0200
Subject: [PATCH 13/13] rpcserver: don't call xmlserver.Command

xmlserver.Command does not have to be called so don't.

Fixes pylint: not-callable error.

https://pagure.io/freeipa/issue/6874
---
 ipaserver/rpcserver.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 9ec7059967..5fb9d870ec 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -715,7 +715,7 @@ def listMethods(self, *params):
         """list methods for XML-RPC introspection"""
         if params:
             raise errors.ZeroArgumentError(name='system.listMethods')
-        return (tuple(unicode(cmd.name) for cmd in self.Command()
+        return (tuple(unicode(cmd.name) for cmd in self.Command
                       if cmd is self.Command[cmd.name]) +
                 tuple(unicode(name) for name in self._system_commands))
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to