mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Address issues found by new pylint 2.5.0
* fix multiple exception-escape * fix function signatures of DsInstance start/stop/restart * silence f-string-without-interpolation * fix too-many-function-args in host plugin Fixes: https://pagure.io/freeipa/issue/8297 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Stanislav Levin <slev@altlinux.org>
This commit is contained in:
committed by
François Cami
parent
b7415c3ddc
commit
9941c9ee95
@@ -1901,9 +1901,9 @@ def get_ca_certs(fstore, options, server, basedn, realm):
|
||||
if os.path.exists(ca_file):
|
||||
try:
|
||||
os.unlink(ca_file)
|
||||
except OSError as e:
|
||||
except OSError as e2:
|
||||
logger.error(
|
||||
"Failed to remove '%s': %s", ca_file, e)
|
||||
"Failed to remove '%s': %s", ca_file, e2)
|
||||
raise errors.FileError(
|
||||
reason=u"cannot write certificate file '%s': %s" % (
|
||||
ca_file, e)
|
||||
|
||||
@@ -652,21 +652,27 @@ class DsInstance(service.Service):
|
||||
# Does not apply with newer DS releases
|
||||
pass
|
||||
|
||||
def start(self, *args, **kwargs):
|
||||
super(DsInstance, self).start(*args, **kwargs)
|
||||
def start(self, instance_name="", capture_output=True, wait=True):
|
||||
super(DsInstance, self).start(
|
||||
instance_name, capture_output=capture_output, wait=wait
|
||||
)
|
||||
api.Backend.ldap2.connect()
|
||||
|
||||
def stop(self, *args, **kwargs):
|
||||
def stop(self, instance_name="", capture_output=True):
|
||||
if api.Backend.ldap2.isconnected():
|
||||
api.Backend.ldap2.disconnect()
|
||||
|
||||
super(DsInstance, self).stop(*args, **kwargs)
|
||||
super(DsInstance, self).stop(
|
||||
instance_name, capture_output=capture_output
|
||||
)
|
||||
|
||||
def restart(self, instance=''):
|
||||
def restart(self, instance_name="", capture_output=True, wait=True):
|
||||
api.Backend.ldap2.disconnect()
|
||||
try:
|
||||
super(DsInstance, self).restart(instance)
|
||||
if not is_ds_running(instance):
|
||||
super(DsInstance, self).restart(
|
||||
instance_name, capture_output=capture_output, wait=wait
|
||||
)
|
||||
if not is_ds_running(instance_name):
|
||||
logger.critical("Failed to restart the directory server. "
|
||||
"See the installation log for details.")
|
||||
raise ScriptError()
|
||||
|
||||
@@ -352,8 +352,8 @@ def upgrade_adtrust_config():
|
||||
"max smbd processes", "1000"]
|
||||
try:
|
||||
ipautil.run(args)
|
||||
except ipautil.CalledProcessError as e:
|
||||
logger.warning("Error updating Samba registry: %s", e)
|
||||
except ipautil.CalledProcessError as e2:
|
||||
logger.warning("Error updating Samba registry: %s", e2)
|
||||
else:
|
||||
logger.warning("Error updating Samba registry: %s", e)
|
||||
|
||||
|
||||
@@ -858,8 +858,8 @@ migration process might be incomplete\n''')
|
||||
try:
|
||||
callback(
|
||||
ldap, entry_attrs.dn, entry_attrs, e, options)
|
||||
except errors.ExecutionError as e:
|
||||
failed[ldap_obj_name][pkey] = unicode(e)
|
||||
except errors.ExecutionError as e2:
|
||||
failed[ldap_obj_name][pkey] = unicode(e2)
|
||||
continue
|
||||
else:
|
||||
failed[ldap_obj_name][pkey] = unicode(e)
|
||||
|
||||
@@ -134,7 +134,13 @@ class Host(pytest_multihost.host.Host):
|
||||
else:
|
||||
cls = Host
|
||||
|
||||
return cls(domain, hostname, role, ip, external_hostname)
|
||||
return cls(
|
||||
domain,
|
||||
hostname,
|
||||
role,
|
||||
ip=ip,
|
||||
external_hostname=external_hostname
|
||||
)
|
||||
|
||||
def ldap_connect(self):
|
||||
"""Return an LDAPClient authenticated to this host as directory manager
|
||||
|
||||
Reference in New Issue
Block a user