logger: Use warning instead of warn

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Tomas Babej
2016-01-15 16:25:33 +01:00
committed by Martin Basti
parent e7a4faab81
commit 78c5bf9f8e
11 changed files with 25 additions and 25 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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))

View File

@@ -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:

View File

@@ -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()

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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()

View File

@@ -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)