diff --git a/install/tools/ipa-adtrust-install.in b/install/tools/ipa-adtrust-install.in index f245ab342..cb2b78e50 100644 --- a/install/tools/ipa-adtrust-install.in +++ b/install/tools/ipa-adtrust-install.in @@ -202,7 +202,7 @@ def main(): if not (user['uid'][0] in group['member_user'] and group['cn'][0] in user['memberof_group']): raise errors.RequirementError(name='admins group membership') - except errors.RequirementError as e: + except errors.RequirementError: raise ScriptError( "Must have administrative privileges to setup AD trusts on server" ) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 14eaa0d6f..622449b11 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -3336,7 +3336,7 @@ def uninstall(options): ipa_domain = domain.get_option('ipa_domain') except SSSDConfig.NoOptionError: pass - except Exception as e: + except Exception: # We were unable to read existing SSSD config. This might mean few # things: # - sssd wasn't installed diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 8e53fec2e..9801f8a3e 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -661,7 +661,7 @@ class API(ReadOnly): except errors.SkipPluginModule as e: logger.debug("skipping plugin module %s: %s", name, e.reason) continue - except Exception as e: + except Exception: tb = self.env.startup_traceback if tb: # pylint: disable=using-constant-test logger.exception("could not load plugin module %s", name) diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 431436f60..49e25670c 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -742,7 +742,7 @@ class KerbTransport(SSLTransport): self.close() logger.debug("HTTP server has closed connection (%s)", host) raise - except BaseException as e: + except BaseException: # Unexpected exception may leave connections in a bad state. self.close() logger.debug("HTTP connection destroyed (%s)", @@ -837,7 +837,7 @@ class KerbTransport(SSLTransport): cookie_string, principal) try: update_persistent_client_session_data(principal, cookie_string) - except Exception as e: + except Exception: # Not fatal, we just can't use the session cookie we were sent. pass @@ -977,7 +977,7 @@ class RPCClient(Connectible): principal, e) try: delete_persistent_client_session_data(principal) - except Exception as e: + except Exception: pass return original_url except Cookie.URLMismatch as e: diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index 2e716570d..741f0608f 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -277,7 +277,7 @@ class DomainValidator: result[t_partner] = (fname_norm, security.dom_sid(trusted_sid)) return result - except errors.NotFound as exc: + except errors.NotFound: return [] def set_trusted_domains(self): @@ -816,7 +816,7 @@ class DomainValidator: try: answers = query_srv(gc_name) - except DNSException as e: + except DNSException: answers = [] for answer in answers: diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index 28d4ce5ba..c6ba2d93a 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -642,7 +642,7 @@ class Restore(admintool.AdminTool): template_dir = paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance try: os.makedirs(template_dir) - except OSError as e: + except OSError: pass constants.DS_USER.chown(template_dir) diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index 2492bb369..a307942c4 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -645,7 +645,7 @@ class LDAPUpdate: while True: try: entry = self.conn.get_entry(dn, attrlist) - except errors.NotFound as e: + except errors.NotFound: logger.error("Task not found: %s", dn) return except errors.DatabaseError as e: diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py index f20bf46ac..a9dd6ea60 100644 --- a/ipaserver/install/replication.py +++ b/ipaserver/install/replication.py @@ -1366,7 +1366,7 @@ class ReplicationManager: try: self.conn.add_entry(entry) - except Exception as e: + except Exception: logger.info("Failed to create public entry for winsync replica") # For winsync, unhashed passwords needs to be in replication changelog diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py index 3f07b8ce3..cae85f620 100644 --- a/ipaserver/install/server/install.py +++ b/ipaserver/install/server/install.py @@ -132,7 +132,7 @@ def read_cache(dm_password): fname, dm_password, top_dir) - except Exception as e: + except Exception: shutil.rmtree(top_dir) raise Exception("Decryption of answer cache in %s failed, please " "check your password." % paths.ROOT_IPA_CACHE) diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py index add8d8fb9..6b93d6f01 100644 --- a/ipaserver/install/server/upgrade.py +++ b/ipaserver/install/server/upgrade.py @@ -1311,7 +1311,7 @@ def ntpd_cleanup(fqdn, fstore): try: instance.disable() instance.stop() - except Exception as e: + except Exception: logger.debug("Service ntpd was not disabled or stopped") for ntpd_file in [paths.NTP_CONF, paths.NTP_STEP_TICKERS, diff --git a/ipaserver/plugins/aci.py b/ipaserver/plugins/aci.py index f15eea876..671057fe8 100644 --- a/ipaserver/plugins/aci.py +++ b/ipaserver/plugins/aci.py @@ -377,7 +377,7 @@ def _aci_to_kw(ldap, a, test=False, pkey_only=False): entry = ldap.make_entry(dn) try: entry = ldap.get_entry(groupdn, ['cn']) - except errors.NotFound as e: + except errors.NotFound: # FIXME, use real name here if test: dn = DN(('cn', 'test'), api.env.container_permission, diff --git a/ipaserver/plugins/migration.py b/ipaserver/plugins/migration.py index 6ee205fc8..6b80235ee 100644 --- a/ipaserver/plugins/migration.py +++ b/ipaserver/plugins/migration.py @@ -216,7 +216,7 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs logger.warning('GID number %s of migrated user %s should ' 'match 1 group, but it matched %d groups', entry_attrs['gidnumber'][0], pkey, e.found) - except errors.LimitsExceeded as e: + except errors.LimitsExceeded: logger.warning('Search limit exceeded searching for GID %s', entry_attrs['gidnumber'][0]) diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py index 20c536e4d..1f85e9898 100644 --- a/ipaserver/rpcserver.py +++ b/ipaserver/rpcserver.py @@ -1095,7 +1095,7 @@ class login_password(Backend, KerberosSession): armor_path, pkinit_anchors=[paths.KDC_CERT, paths.KDC_CA_BUNDLE_PEM], ) - except RuntimeError as e: + except RuntimeError: logger.error("Failed to obtain armor cache") # We try to continue w/o armor, 2FA will be impacted armor_path = None @@ -1159,8 +1159,10 @@ class change_password(Backend, HTTP_Status): try: query_dict = parse_qs(query_string) - except Exception as e: - return self.bad_request(environ, start_response, "cannot parse query data") + except Exception: + return self.bad_request( + environ, start_response, "cannot parse query data" + ) data = {} for field in ('user', 'old_password', 'new_password', 'otp'): @@ -1264,8 +1266,10 @@ class sync_token(Backend, HTTP_Status): # Parse the query string to a dictionary. try: query_dict = parse_qs(query_string) - except Exception as e: - return self.bad_request(environ, start_response, "cannot parse query data") + except Exception: + return self.bad_request( + environ, start_response, "cannot parse query data" + ) data = {} for field in ('user', 'password', 'first_code', 'second_code', 'token'): value = query_dict.get(field, None)