summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipaclient/plugins/cert.py2
-rw-r--r--ipalib/certstore.py12
-rw-r--r--ipalib/frontend.py16
-rw-r--r--ipalib/parameters.py6
-rw-r--r--ipalib/rpc.py16
-rw-r--r--ipalib/util.py12
-rw-r--r--ipapython/certdb.py8
-rw-r--r--ipapython/certmonger.py10
-rw-r--r--ipapython/cookie.py11
-rwxr-xr-xipapython/dnssec/localhsm.py4
-rw-r--r--ipapython/ipaldap.py12
-rw-r--r--ipapython/ipautil.py14
-rw-r--r--ipapython/p11helper.py16
-rw-r--r--ipapython/sysrestore.py15
14 files changed, 53 insertions, 101 deletions
diff --git a/ipaclient/plugins/cert.py b/ipaclient/plugins/cert.py
index 5e791ce6e..1075972c4 100644
--- a/ipaclient/plugins/cert.py
+++ b/ipaclient/plugins/cert.py
@@ -27,8 +27,6 @@ from ipalib.parameters import File, Flag, Str
from ipalib.plugable import Registry
from ipalib.text import _
-# pylint: disable=unused-variable
-
register = Registry()
diff --git a/ipalib/certstore.py b/ipalib/certstore.py
index d71cbd9f5..d17cb2baa 100644
--- a/ipalib/certstore.py
+++ b/ipalib/certstore.py
@@ -29,8 +29,6 @@ from ipapython.dn import DN
from ipapython.certdb import get_ca_nickname
from ipalib import errors, x509
-# pylint: disable=unused-variable
-
def _parse_cert(dercert):
try:
subject = x509.get_subject(dercert, x509.DER)
@@ -108,7 +106,7 @@ def clean_old_config(ldap, base_dn, dn, config_ipa, config_compat):
return
try:
- result, truncated = ldap.find_entries(
+ result, _truncated = ldap.find_entries(
base_dn=DN(('cn', 'certificates'), ('cn', 'ipa'), ('cn', 'etc'),
base_dn),
filter='(|(ipaConfigString=ipaCA)(ipaConfigString=compatCA))',
@@ -162,7 +160,7 @@ def update_ca_cert(ldap, base_dn, dercert, trusted=None, ext_key_usage=None,
subject, issuer_serial, public_key = _parse_cert(dercert)
filter = ldap.make_filter({'ipaCertSubject': subject})
- result, truncated = ldap.find_entries(
+ result, _truncated = ldap.find_entries(
base_dn=DN(('cn', 'certificates'), ('cn', 'ipa'), ('cn', 'etc'),
base_dn),
filter=filter,
@@ -247,7 +245,7 @@ def make_compat_ca_certs(certs, realm, ipa_ca_subject):
result = []
for cert in certs:
- subject, issuer_serial, public_key_info = _parse_cert(cert)
+ subject, _issuer_serial, _public_key_info = _parse_cert(cert)
subject = DN(subject)
if ipa_ca_subject is not None and subject == DN(ipa_ca_subject):
@@ -285,7 +283,7 @@ def get_ca_certs(ldap, base_dn, compat_realm, compat_ipa_ca,
if filter_subject:
filter = ldap.make_filter({'ipaCertSubject': filter_subject})
filters.append(filter)
- result, truncated = ldap.find_entries(
+ result, _truncated = ldap.find_entries(
base_dn=container_dn,
filter=ldap.combine_filters(filters, ldap.MATCH_ALL),
attrs_list=['cn', 'ipaCertSubject', 'ipaCertIssuerSerial',
@@ -323,7 +321,7 @@ def get_ca_certs(ldap, base_dn, compat_realm, compat_ipa_ca,
cert = entry.single_value['cACertificate;binary']
try:
- subject, issuer_serial, public_key_info = _parse_cert(cert)
+ subject, _issuer_serial, _public_key_info = _parse_cert(cert)
except ValueError:
pass
else:
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index ca06f6f74..c94d17467 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -40,8 +40,6 @@ from ipalib import errors, messages
from ipalib.request import context, context_frame
from ipalib.util import classproperty, json_serialize
-# pylint: disable=unused-variable
-
if six.PY3:
unicode = str
@@ -777,10 +775,8 @@ class Command(HasParam):
if len(ver.version) < 2:
raise VersionError(cver=ver.version, sver=server_ver.version, server= self.env.xmlrpc_uri)
client_major = ver.version[0]
- client_minor = ver.version[1]
server_major = server_ver.version[0]
- server_minor = server_ver.version[1]
if server_major != client_major:
raise VersionError(cver=client_version, sver=API_VERSION, server=self.env.xmlrpc_uri)
@@ -1279,18 +1275,8 @@ class Object(HasParam):
This method gets called by `HasParam._create_param_namespace()`.
"""
for spec in self._get_param_iterable('params'):
- if type(spec) is str:
- key = spec.rstrip('?*+')
- else:
- assert isinstance(spec, Param)
- key = spec.name
+ assert isinstance(spec, (str, Param))
yield create_param(spec)
- def get_key(p):
- if p.param.required:
- if p.param.default_from is None:
- return 0
- return 1
- return 2
json_friendly_attributes = (
'name', 'takes_params',
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 32ff9a8df..1117fbeff 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -119,7 +119,6 @@ from ipapython import kerberos
from ipapython.dn import DN
from ipapython.dnsutil import DNSName
-# pylint: disable=unused-variable
def _is_null(value):
return not value and value != 0 # NOTE: False == 0
@@ -946,7 +945,7 @@ class Param(ReadOnly):
def __json__(self):
json_dict = {}
- for (a, k, d) in self.kwargs:
+ for a, k, _d in self.kwargs:
if k in (callable, DefaultFrom):
continue
elif isinstance(getattr(self, a), frozenset):
@@ -1786,7 +1785,6 @@ class AccessTime(Str):
if ts[index] == 'month':
index += 1
self._check_interval(ts[index], self._check_month_num)
- month_num = int(ts[index])
index = self._check_M_spec(ts, index + 1)
elif ts[index] == 'week':
self._check_interval(ts[index + 1], self._check_woty)
@@ -1940,8 +1938,6 @@ class DNSNameParam(Param):
def _convert_scalar(self, value, index=None):
if isinstance(value, unicode):
- error = None
-
try:
validate_idna_domain(value)
except ValueError as e:
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index 4fb560baf..19ce0cc9e 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -70,8 +70,6 @@ from ipapython.kerberos import Principal
from ipalib.capabilities import VERSION_WITHOUT_CAPABILITIES
from ipalib import api
-# pylint: disable=unused-variable
-
# The XMLRPC client is in "six.moves.xmlrpc_client", but pylint
# cannot handle that
try:
@@ -491,7 +489,7 @@ class SSLTransport(LanguageAwareTransport):
return None
def make_connection(self, host):
- host, self._extra_headers, x509 = self.get_host_info(host)
+ host, self._extra_headers, _x509 = self.get_host_info(host)
if self._connection and host == self._connection[0]:
return self._connection[1]
@@ -595,7 +593,7 @@ class KerbTransport(SSLTransport):
header = response.getheader('www-authenticate', '')
token = None
for field in header.split(','):
- k, _, v = field.strip().partition(' ')
+ k, _dummy, v = field.strip().partition(' ')
if k.lower() == 'negotiate':
try:
token = base64.b64decode(v.encode('ascii'))
@@ -751,14 +749,14 @@ class RPCClient(Connectible):
Create a list of urls consisting of the available IPA servers.
"""
# the configured URL defines what we use for the discovered servers
- (scheme, netloc, path, params, query, fragment
+ (_scheme, _netloc, path, _params, _query, _fragment
) = urllib.parse.urlparse(rpc_uri)
servers = []
name = '_ldap._tcp.%s.' % self.env.domain
try:
answers = resolver.query(name, rdatatype.SRV)
- except DNSException as e:
+ except DNSException:
answers = []
for answer in answers:
@@ -791,13 +789,13 @@ class RPCClient(Connectible):
# (possibly with more than one cookie).
try:
cookie_string = read_persistent_client_session_data(principal)
- except Exception as e:
+ except Exception:
return None
# Search for the session cookie within the cookie string
try:
session_cookie = Cookie.get_named_cookie_from_string(cookie_string, COOKIE_NAME)
- except Exception as e:
+ except Exception:
return None
return session_cookie
@@ -914,7 +912,7 @@ class RPCClient(Connectible):
try:
command = getattr(serverproxy, 'ping')
try:
- response = command([], {})
+ command([], {})
except Fault as e:
e = decode_fault(e)
if e.faultCode in errors_by_code:
diff --git a/ipalib/util.py b/ipalib/util.py
index 4df6847ed..1c00cd748 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -51,8 +51,6 @@ from ipapython.dnsutil import DNSName
from ipapython.dnsutil import resolve_ip_addresses
from ipapython.ipa_log_manager import root_logger
-# pylint: disable=unused-variable
-
if six.PY3:
unicode = str
@@ -176,7 +174,7 @@ def normalize_zonemgr(zonemgr):
return zonemgr
if '@' in zonemgr:
# local-part needs to be normalized
- name, at, domain = zonemgr.partition('@')
+ name, _at, domain = zonemgr.partition('@')
name = name.replace('.', '\\.')
zonemgr = u''.join((name, u'.', domain))
@@ -542,7 +540,7 @@ def get_reverse_zone_default(ip_address):
def validate_rdn_param(ugettext, value):
try:
- rdn = RDN(value)
+ RDN(value)
except Exception as e:
return str(e)
return None
@@ -794,8 +792,6 @@ def detect_dns_zone_realm_type(api, domain):
domain_suffix = DNSName(domain)
kerberos_record_name = kerberos_prefix + domain_suffix
- response = None
-
try:
result = resolver.query(kerberos_record_name, rdatatype.TXT)
answer = result.response.answer
@@ -813,7 +809,7 @@ def detect_dns_zone_realm_type(api, domain):
else:
return 'foreign'
- except DNSException as e:
+ except DNSException:
pass
# Try to detect AD specific record in the zone.
@@ -827,7 +823,7 @@ def detect_dns_zone_realm_type(api, domain):
result = resolver.query(ad_specific_record_name, rdatatype.SRV)
return 'foreign'
- except DNSException as e:
+ except DNSException:
pass
# If we could not detect type with certainity, return unknown
diff --git a/ipapython/certdb.py b/ipapython/certdb.py
index 850ba59bf..06666c022 100644
--- a/ipapython/certdb.py
+++ b/ipapython/certdb.py
@@ -30,8 +30,6 @@ from ipapython.ipa_log_manager import root_logger
from ipapython import ipautil
from ipalib import x509
-# pylint: disable=unused-variable
-
CA_NICKNAME_FMT = "%s IPA CA"
@@ -359,7 +357,7 @@ class NSSDatabase(object):
server_certs = self.find_server_certs()
if key_nickname:
- for nickname, trust_flags in server_certs:
+ for nickname, _trust_flags in server_certs:
if nickname == key_nickname:
break
else:
@@ -422,7 +420,7 @@ class NSSDatabase(object):
try:
self.run_certutil(["-M", "-n", root_nickname,
"-t", trust_flags])
- except ipautil.CalledProcessError as e:
+ except ipautil.CalledProcessError:
raise RuntimeError(
"Setting trust on %s failed" % root_nickname)
@@ -434,7 +432,7 @@ class NSSDatabase(object):
raise RuntimeError("Failed to get %s" % nickname)
cert = result.output
if not pem:
- (cert, start) = find_cert_from_txt(cert, start=0)
+ cert, _start = find_cert_from_txt(cert, start=0)
cert = x509.strip_header(cert)
cert = base64.b64decode(cert)
return cert
diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py
index 8c3faf029..765f9e887 100644
--- a/ipapython/certmonger.py
+++ b/ipapython/certmonger.py
@@ -34,8 +34,6 @@ from ipapython.ipa_log_manager import root_logger
from ipaplatform.paths import paths
from ipaplatform import services
-# pylint: disable=unused-variable
-
DBUS_CM_PATH = '/org/fedorahosted/certmonger'
DBUS_CM_IF = 'org.fedorahosted.certmonger'
DBUS_CM_NAME = 'org.fedorahosted.certmonger'
@@ -88,7 +86,7 @@ class _certmonger(_cm_dbus_object):
sock_filename = os.path.join(tempfile.mkdtemp(), 'certmonger')
self._proc = subprocess.Popen([paths.CERTMONGER, '-n', '-L', '-P',
sock_filename])
- for t in range(0, self.timeout, 5):
+ for _t in range(0, self.timeout, 5):
if os.path.exists(sock_filename):
return "unix:path=%s" % sock_filename
time.sleep(5)
@@ -101,7 +99,7 @@ class _certmonger(_cm_dbus_object):
if retcode is not None:
return
self._proc.terminate()
- for t in range(0, self.timeout, 5):
+ for _t in range(0, self.timeout, 5):
retcode = self._proc.poll()
if retcode is not None:
return
@@ -140,7 +138,7 @@ class _certmonger(_cm_dbus_object):
root_logger.error("Failed to start certmonger: %s" % e)
raise
- for t in range(0, self.timeout, 5):
+ for _t in range(0, self.timeout, 5):
try:
self._bus.get_name_owner(DBUS_CM_NAME)
break
@@ -535,7 +533,7 @@ def check_state(dirs):
def wait_for_request(request_id, timeout=120):
- for i in range(0, timeout, 5):
+ for _i in range(0, timeout, 5):
state = get_request_value(request_id, 'status')
root_logger.debug("certmonger request is in state %r", state)
if state in ('CA_REJECTED', 'CA_UNREACHABLE', 'CA_UNCONFIGURED',
diff --git a/ipapython/cookie.py b/ipapython/cookie.py
index eaf6a37e7..97f24b2fb 100644
--- a/ipapython/cookie.py
+++ b/ipapython/cookie.py
@@ -27,8 +27,6 @@ from six.moves.urllib.parse import urlparse
from ipapython.ipa_log_manager import log_mgr
-# pylint: disable=unused-variable
-
'''
Core Python has two cookie libraries, Cookie.py targeted to server
side and cookielib.py targeted to client side. So why this module and
@@ -542,7 +540,7 @@ class Cookie(object):
received from.
'''
- scheme, domain, path, params, query, fragment = urlparse(url)
+ _scheme, domain, path, _params, _query, _fragment = urlparse(url)
if self.domain is None:
self.domain = domain.lower()
@@ -599,7 +597,7 @@ class Cookie(object):
from ipalib.util import validate_domain_name
try:
validate_domain_name(url_domain)
- except Exception as e:
+ except Exception:
return False
if cookie_domain is None:
@@ -644,7 +642,10 @@ class Cookie(object):
cookie_name = self.key
- url_scheme, url_domain, url_path, url_params, url_query, url_fragment = urlparse(url)
+ (
+ url_scheme, url_domain, url_path,
+ _url_params, _url_query, _url_fragment
+ ) = urlparse(url)
cookie_expiration = self.get_expiration()
if cookie_expiration is not None:
diff --git a/ipapython/dnssec/localhsm.py b/ipapython/dnssec/localhsm.py
index 338adda0f..d02fc75d1 100755
--- a/ipapython/dnssec/localhsm.py
+++ b/ipapython/dnssec/localhsm.py
@@ -18,8 +18,6 @@ from ipapython.dnssec.abshsm import (attrs_name2id, attrs_id2name, AbstractHSM,
keytype_id2name, keytype_name2id,
ldap2p11helper_api_params)
-# pylint: disable=unused-variable
-
private_key_api_params = set(["label", "id", "data", "unwrapping_key",
"wrapping_mech", "key_type", "cka_always_authenticate", "cka_copyable",
"cka_decrypt", "cka_derive", "cka_extractable", "cka_modifiable",
@@ -81,7 +79,7 @@ class Key(collections.MutableMapping):
def __len__(self):
cnt = 0
- for attr in self:
+ for _attr in self:
cnt += 1
return cnt
diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 2dfc5b350..c6f0aaa2e 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -44,8 +44,6 @@ from ipapython.dn import DN
from ipapython.dnsutil import DNSName
from ipapython.kerberos import Principal
-# pylint: disable=unused-variable
-
if six.PY3:
unicode = str
@@ -890,7 +888,7 @@ class LDAPClient(object):
return DNSName.from_text(val)
else:
return target_type(val)
- except Exception as e:
+ except Exception:
msg = 'unable to convert the attribute %r value %r to type %s' % (attr, val, target_type)
self.log.error(msg)
raise ValueError(msg)
@@ -1206,10 +1204,6 @@ class LDAPClient(object):
False - forbid trailing filter wildcard when exact=False
"""
if isinstance(value, (list, tuple)):
- if rules == cls.MATCH_NONE:
- make_filter_rules = cls.MATCH_ANY
- else:
- make_filter_rules = rules
flts = [
cls.make_filter_from_attr(
attr, v, exact=exact,
@@ -1384,7 +1378,7 @@ class LDAPClient(object):
)
while True:
result = self.conn.result3(id, 0)
- objtype, res_list, res_id, res_ctrls = result
+ objtype, res_list, _res_id, res_ctrls = result
res_list = self._convert_result(res_list)
if not res_list:
break
@@ -1682,7 +1676,7 @@ class IPAdmin(LDAPClient):
pw_name = pwd.getpwuid(os.geteuid()).pw_name
self.do_external_bind(pw_name, timeout=timeout)
return
- except errors.NotFound as e:
+ except errors.NotFound:
if autobind == AUTOBIND_ENABLED:
# autobind was required and failed, raise
# exception that it failed
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 41544a114..b0aa26285 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -54,8 +54,6 @@ from ipapython import config
from ipaplatform.paths import paths
from ipapython.dn import DN
-# pylint: disable=unused-variable
-
SHARE_DIR = paths.USR_SHARE_IPA_DIR
PLUGINS_SHARE_DIR = paths.IPA_PLUGINS
@@ -115,7 +113,7 @@ class UnsafeIPAddress(netaddr.IPAddress):
# netaddr.IPAddress doesn't handle zone indices in textual
# IPv6 addresses. Try removing zone index and parse the
# address again.
- addr, sep, foo = addr.partition('%')
+ addr, sep, _foo = addr.partition('%')
if sep != '%':
raise
addr = netaddr.IPAddress(addr, flags=self.netaddr_ip_flags)
@@ -933,7 +931,7 @@ def user_input(prompt, default = None, allow_empty = True):
def host_port_open(host, port, socket_type=socket.SOCK_STREAM, socket_timeout=None):
for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket_type):
- af, socktype, proto, canonname, sa = res
+ af, socktype, proto, _canonname, sa = res
try:
try:
s = socket.socket(af, socktype, proto)
@@ -951,7 +949,7 @@ def host_port_open(host, port, socket_type=socket.SOCK_STREAM, socket_timeout=No
s.recv(512)
return True
- except socket.error as e:
+ except socket.error:
pass
finally:
if s:
@@ -976,7 +974,7 @@ def bind_port_responder(port, socket_type=socket.SOCK_STREAM, socket_timeout=Non
last_socket_error = e
continue
for res in addr_infos:
- af, socktype, proto, canonname, sa = res
+ af, socktype, proto, _canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error as e:
@@ -1003,14 +1001,14 @@ def bind_port_responder(port, socket_type=socket.SOCK_STREAM, socket_timeout=Non
while True:
if socket_type == socket.SOCK_STREAM:
s.listen(1)
- connection, client_address = s.accept()
+ connection, _client_address = s.accept()
try:
if responder_data:
connection.sendall(responder_data)
finally:
connection.close()
elif socket_type == socket.SOCK_DGRAM:
- data, addr = s.recvfrom(1)
+ _data, addr = s.recvfrom(1)
if responder_data:
s.sendto(responder_data, addr)
diff --git a/ipapython/p11helper.py b/ipapython/p11helper.py
index 0001b6a34..5963c6d71 100644
--- a/ipapython/p11helper.py
+++ b/ipapython/p11helper.py
@@ -12,8 +12,6 @@ from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
from cffi import FFI
-# pylint: disable=unused-variable
-
if six.PY3:
unicode = str
@@ -931,7 +929,7 @@ class P11_Helper(object):
raise DuplicationError("Master key with same ID already exists")
# Process keyword boolean arguments
- (cka_copyable_ptr, cka_decrypt_ptr, cka_derive_ptr, cka_encrypt_ptr,
+ (_cka_copyable_ptr, cka_decrypt_ptr, cka_derive_ptr, cka_encrypt_ptr,
cka_extractable_ptr, cka_modifiable_ptr, cka_private_ptr,
cka_sensitive_ptr, cka_sign_ptr, cka_unwrap_ptr, cka_verify_ptr,
cka_wrap_ptr, cka_wrap_with_trusted_ptr,) = convert_py2bool(attrs)
@@ -1041,14 +1039,14 @@ class P11_Helper(object):
modulus_bits_ptr = new_ptr(CK_ULONG, modulus_bits)
# Process keyword boolean arguments
- (pub_cka_copyable_ptr, pub_cka_derive_ptr, pub_cka_encrypt_ptr,
+ (_pub_cka_copyable_ptr, pub_cka_derive_ptr, pub_cka_encrypt_ptr,
pub_cka_modifiable_ptr, pub_cka_private_ptr, pub_cka_trusted_ptr,
pub_cka_verify_ptr, pub_cka_verify_recover_ptr, pub_cka_wrap_ptr,
) = convert_py2bool(attrs_pub)
- (priv_cka_always_authenticate_ptr, priv_cka_copyable_ptr,
+ (priv_cka_always_authenticate_ptr, _priv_cka_copyable_ptr,
priv_cka_decrypt_ptr, priv_cka_derive_ptr, priv_cka_extractable_ptr,
priv_cka_modifiable_ptr, priv_cka_private_ptr, priv_cka_sensitive_ptr,
- priv_cka_sign_ptr, priv_cka_sign_recover_ptr, priv_cka_unwrap_ptr,
+ priv_cka_sign_ptr, _priv_cka_sign_recover_ptr, priv_cka_unwrap_ptr,
priv_cka_wrap_with_trusted_ptr,) = convert_py2bool(attrs_priv)
# 65537 (RFC 6376 section 3.3.1)
@@ -1486,7 +1484,7 @@ class P11_Helper(object):
raise DuplicationError("Secret key with same ID already exists")
# Process keyword boolean arguments
- (cka_copyable_ptr, cka_decrypt_ptr, cka_derive_ptr, cka_encrypt_ptr,
+ (_cka_copyable_ptr, cka_decrypt_ptr, cka_derive_ptr, cka_encrypt_ptr,
cka_extractable_ptr, cka_modifiable_ptr, cka_private_ptr,
cka_sensitive_ptr, cka_sign_ptr, cka_unwrap_ptr, cka_verify_ptr,
cka_wrap_ptr, cka_wrap_with_trusted_ptr,) = convert_py2bool(attrs)
@@ -1572,10 +1570,10 @@ class P11_Helper(object):
raise DuplicationError("Secret key with same ID already exists")
# Process keyword boolean arguments
- (cka_always_authenticate_ptr, cka_copyable_ptr, cka_decrypt_ptr,
+ (cka_always_authenticate_ptr, _cka_copyable_ptr, cka_decrypt_ptr,
cka_derive_ptr, cka_extractable_ptr, cka_modifiable_ptr,
cka_private_ptr, cka_sensitive_ptr, cka_sign_ptr,
- cka_sign_recover_ptr, cka_unwrap_ptr, cka_wrap_with_trusted_ptr,
+ _cka_sign_recover_ptr, cka_unwrap_ptr, cka_wrap_with_trusted_ptr,
) = convert_py2bool(attrs_priv)
template = new_array(CK_ATTRIBUTE, (
diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index 4e3cccb06..2a8f44826 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -35,8 +35,6 @@ from six.moves.configparser import SafeConfigParser
from ipaplatform.tasks import tasks
from ipaplatform.paths import paths
-# pylint: disable=unused-variable
-
if six.PY3:
unicode = str
@@ -118,10 +116,10 @@ class FileStore(object):
root_logger.debug(" -> Not backing up - '%s' doesn't exist", path)
return
- (reldir, backupfile) = os.path.split(path)
+ _reldir, backupfile = os.path.split(path)
filename = ""
- for i in range(8):
+ for _i in range(8):
h = "%02x" % self.random.randint(0,255)
filename += h
filename += "-"+backupfile
@@ -145,8 +143,8 @@ class FileStore(object):
Returns #True if the file exists in the file store, #False otherwise
"""
result = False
- for (key, value) in self.files.items():
- (mode,uid,gid,filepath) = value.split(',', 3)
+ for _key, value in self.files.items():
+ _mode, _uid, _gid, filepath = value.split(',', 3)
if (filepath == path):
result = True
break
@@ -264,13 +262,10 @@ class FileStore(object):
if not os.path.isabs(path):
raise ValueError("Absolute path required")
- mode = None
- uid = None
- gid = None
filename = None
for (key, value) in self.files.items():
- (mode,uid,gid,filepath) = value.split(',', 3)
+ _mode, _uid, _gid, filepath = value.split(',', 3)
if (filepath == path):
filename = key
break