Hi, this should build up to another pylint-related patch Martin^2 has in works.
Tomas
From b5e445c1dfdd469a7b85ba418b910f2a85fa470f Mon Sep 17 00:00:00 2001 From: Tomas Babej <tba...@redhat.com> Date: Fri, 15 Jan 2016 16:25:33 +0100 Subject: [PATCH] logger: Use warning instead of warn --- install/tools/ipa-httpd-kdcproxy | 10 +++++----- ipa-client/ipaclient/ipadiscovery.py | 6 +++--- ipalib/plugins/dns.py | 2 +- ipalib/plugins/migration.py | 16 ++++++++-------- ipalib/plugins/passwd.py | 2 +- ipalib/plugins/permission.py | 4 ++-- ipaserver/dcerpc.py | 2 +- ipaserver/install/ipa_otptoken_import.py | 2 +- ipaserver/install/ipa_replica_prepare.py | 2 +- ipaserver/install/ipa_restore.py | 2 +- ipatests/pytest_plugins/integration.py | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/install/tools/ipa-httpd-kdcproxy b/install/tools/ipa-httpd-kdcproxy index 5e9863f8bd82e1628030b0b767a6697ab2a1d7bd..5e67f61a6e2b3fe26532323d773bd502ac52f454 100755 --- a/install/tools/ipa-httpd-kdcproxy +++ b/install/tools/ipa-httpd-kdcproxy @@ -141,7 +141,7 @@ class KDCProxyConfig(object): try: valid = self.validate_symlink() except ConfigFileError as e: - self.log.warn("Cannot enable KDC proxy: %s " % e) + self.log.warning("Cannot enable KDC proxy: %s " % e) return False if valid: @@ -149,7 +149,7 @@ class KDCProxyConfig(object): return True if not os.path.isfile(self.conf): - self.log.warn("'%s' does not exist", self.conf) + self.log.warning("'%s' does not exist", self.conf) return False # create the symbolic link @@ -163,7 +163,7 @@ class KDCProxyConfig(object): try: valid = self.validate_symlink() except CheckError as e: - self.log.warn("Cannot disable KDC proxy: %s " % e) + self.log.warning("Cannot disable KDC proxy: %s " % e) return False if valid: @@ -203,8 +203,8 @@ def main(debug=DEBUG, time_limit=TIME_LIMIT): api.log.info('KDC proxy disabled') return 0 except CheckError as e: - api.log.warn(str(e)) - api.log.warn('Disabling KDC proxy') + api.log.warning(str(e)) + api.log.warning('Disabling KDC proxy') cfg.remove_symlink() return 0 except Exception as e: diff --git a/ipa-client/ipaclient/ipadiscovery.py b/ipa-client/ipaclient/ipadiscovery.py index 2e51293c2db35d655b1d9936103a729bd61a60ae..45a71e190e56d33d51d37f16ae61a7b4c28df521 100644 --- a/ipa-client/ipaclient/ipadiscovery.py +++ b/ipa-client/ipaclient/ipadiscovery.py @@ -266,14 +266,14 @@ class IPADiscovery(object): # via DNS break elif ldapret[0] == NOT_IPA_SERVER: - root_logger.warn( + root_logger.warning( 'Skip %s: not an IPA server', server) elif ldapret[0] == NO_LDAP_SERVER: - root_logger.warn( + root_logger.warning( 'Skip %s: LDAP server is not responding, unable to verify if ' 'this is an IPA server', server) else: - root_logger.warn( + root_logger.warning( 'Skip %s: cannot verify if this is an IPA server', server) # If one of LDAP servers checked rejects access (maybe anonymous diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 59cb0ea3982256e9d98b8216207514e28e229d03..55f2609d7081112df2adc909a9c928b50fccdfb1 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -3514,7 +3514,7 @@ class dnsrecord(LDAPObject): except dns.resolver.NoNameservers as e: # Do not raise exception if we have got SERVFAILs. # Maybe the user has created an invalid zone intentionally. - self.log.warn('waiting for DNS answer {%s}: got {%s}; ' + self.log.warning('waiting for DNS answer {%s}: got {%s}; ' 'ignoring', ldap_rrset, type(e)) continue diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py index 59c49fae5441531015a45532df07439daac35290..f19324f0e4e0511f9445aae9e9ac14347da4a03b 100644 --- a/ipalib/plugins/migration.py +++ b/ipalib/plugins/migration.py @@ -168,7 +168,7 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs # See if the gidNumber at least points to a valid group on the remote # server. if entry_attrs['gidnumber'][0] in invalid_gids: - api.log.warn('GID number %s of migrated user %s does not point to a known group.' \ + api.log.warning('GID number %s of migrated user %s does not point to a known group.' \ % (entry_attrs['gidnumber'][0], pkey)) elif entry_attrs['gidnumber'][0] not in valid_gids: try: @@ -178,15 +178,15 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs ) valid_gids.add(entry_attrs['gidnumber'][0]) except errors.NotFound: - api.log.warn('GID number %s of migrated user %s does not point to a known group.' \ + api.log.warning('GID number %s of migrated user %s does not point to a known group.' \ % (entry_attrs['gidnumber'][0], pkey)) invalid_gids.add(entry_attrs['gidnumber'][0]) except errors.SingleMatchExpected as e: # GID number matched more groups, this should not happen - api.log.warn('GID number %s of migrated user %s should match 1 group, but it matched %d groups' \ + api.log.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: - api.log.warn('Search limit exceeded searching for GID %s' % entry_attrs['gidnumber'][0]) + api.log.warning('Search limit exceeded searching for GID %s' % entry_attrs['gidnumber'][0]) # We don't want to create a UPG so set the magic value in description # to let the DS plugin know. @@ -246,14 +246,14 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs try: value = DN(value) except ValueError as e: - api.log.warn('%s: skipping normalization of value %s of type %s ' + api.log.warning('%s: skipping normalization of value %s of type %s ' 'in attribute %s which could not be converted to DN: %s', pkey, value, type(value), attr, e) continue try: remote_entry = ds_ldap.get_entry(value, [api.Object.user.primary_key.name, api.Object.group.primary_key.name]) except errors.NotFound: - api.log.warn('%s: attribute %s refers to non-existent entry %s' % (pkey, attr, value)) + api.log.warning('%s: attribute %s refers to non-existent entry %s' % (pkey, attr, value)) continue if value.endswith(search_bases['user']): primary_key = api.Object.user.primary_key.name @@ -262,11 +262,11 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs primary_key = api.Object.group.primary_key.name container = api.env.container_group else: - api.log.warn('%s: value %s in attribute %s does not belong into any known container' % (pkey, value, attr)) + api.log.warning('%s: value %s in attribute %s does not belong into any known container' % (pkey, value, attr)) continue if not remote_entry.get(primary_key): - api.log.warn('%s: there is no primary key %s to migrate for %s' % (pkey, primary_key, attr)) + api.log.warning('%s: there is no primary key %s to migrate for %s' % (pkey, primary_key, attr)) continue api.log.debug('converting DN value %s for %s in %s' % (value, attr, dn)) diff --git a/ipalib/plugins/passwd.py b/ipalib/plugins/passwd.py index 2f303472c2940e7ba51ac89e0389b2173c18cb1b..b6f14993290a38273d943d7c6554af0f684926ca 100644 --- a/ipalib/plugins/passwd.py +++ b/ipalib/plugins/passwd.py @@ -123,7 +123,7 @@ class passwd(Command): if principal == getattr(context, 'principal') and \ current_password == MAGIC_VALUE: # No cheating - self.log.warn('User attempted to change password using magic value') + self.log.warning('User attempted to change password using magic value') raise errors.ACIError(info=_('Invalid credentials')) if current_password == MAGIC_VALUE: diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py index cbc48f5e8a6e5765d5eca59797ca75b7a9d98244..2312008fa6db646dd4e3e9598daf7ea48c867337 100644 --- a/ipalib/plugins/permission.py +++ b/ipalib/plugins/permission.py @@ -1209,7 +1209,7 @@ class permission_mod(baseldap.LDAPUpdate): # Try to roll back the old ACI entry, old_aci_string = old_aci_info if old_aci_string: - self.log.warn('Reverting ACI on %s to %s' % (entry.dn, + self.log.warning('Reverting ACI on %s to %s' % (entry.dn, old_aci_string)) entry['aci'].append(old_aci_string) self.Backend.ldap2.update_entry(entry) @@ -1227,7 +1227,7 @@ class permission_mod(baseldap.LDAPUpdate): entry.pop('attributelevelrights', None) self.log.error('Error updating ACI: %s' % traceback.format_exc()) - self.log.warn('Reverting entry') + self.log.warning('Reverting entry') old_entry.reset_modlist(entry) ldap.update_entry(old_entry) self._revert_aci() diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index 13cb7767cc2ba303613a2d4065964d51599d728e..adb8136c8abbe5d09a81390ba40135fa36ae442f 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -218,7 +218,7 @@ class DomainValidator(object): except KeyError as e: # Some piece of trusted domain info in LDAP is missing # Skip the domain, but leave log entry for investigation - api.log.warn("Trusted domain '%s' entry misses an " + api.log.warning("Trusted domain '%s' entry misses an " "attribute: %s", entry.dn, e) continue diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py index 731e9ae458865df9934f3c2dafb87254cfa54fd0..9175c928bfbf261693cdcb40d4d406fbcda09094 100644 --- a/ipaserver/install/ipa_otptoken_import.py +++ b/ipaserver/install/ipa_otptoken_import.py @@ -523,7 +523,7 @@ class OTPTokenImport(admintool.AdminTool): try: api.Command.otptoken_add(keypkg.id, no_qrcode=True, **keypkg.options) except Exception as e: - self.log.warn("Error adding token: %s", e) + self.log.warning("Error adding token: %s", e) else: self.log.info("Added token: %s", keypkg.id) keypkg.remove() diff --git a/ipaserver/install/ipa_replica_prepare.py b/ipaserver/install/ipa_replica_prepare.py index e9fd2d91d6901bbd3977931a7008db0317f3873c..17d20322063fbb6f9d65a2528f9db0b07f486ede 100644 --- a/ipaserver/install/ipa_replica_prepare.py +++ b/ipaserver/install/ipa_replica_prepare.py @@ -541,7 +541,7 @@ class ReplicaPrepare(admintool.AdminTool): except exceptions: return False except Exception as e: - self.log.warn('Exception while waiting for DNS record: %s: %s', + self.log.warning('Exception while waiting for DNS record: %s: %s', type(e).__name__, e) return True diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index b223bd287f633b863315661ca27641425529cc40..2c53f038bc5a8d93ab5a5172604413cdc433d8c9 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -366,7 +366,7 @@ class Restore(admintool.AdminTool): self.log.info('Stopping IPA services') result = run(['ipactl', 'stop'], raiseonerr=False) if result.returncode not in [0, 6]: - self.log.warn('Stopping IPA failed: %s' % result.error_log) + self.log.warning('Stopping IPA failed: %s' % result.error_log) self.restore_selinux_booleans() diff --git a/ipatests/pytest_plugins/integration.py b/ipatests/pytest_plugins/integration.py index 5ece996800b43e85bfb891e48ac1a55589d14260..a191d848669111211cc1a13f412e3f777eae565e 100644 --- a/ipatests/pytest_plugins/integration.py +++ b/ipatests/pytest_plugins/integration.py @@ -94,7 +94,7 @@ def collect_logs(name, logs_dict, logfile_dir=None, beakerlib_plugin=None): cmd = host.run_command(['tar', 'cJv'] + logs, log_stdout=False, raiseonerr=False) if cmd.returncode: - log.warn('Could not collect all requested logs') + log.warning('Could not collect all requested logs') # Unpack on the local side dirname = os.path.join(topdirname, host.hostname) -- 2.5.0
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code