Replace deprecated LOG.warn with LOG.warning

LOG.warn is deprecated. It still used in a few places.
Updated to non-deprecated LOG.warning.

Change-Id: If2c041cc6bb9513d528ca35611e1e3a96946ce4d
Closes-Bug:#1508442
This commit is contained in:
Swapnil Kulkarni (coolsvap) 2016-01-05 12:17:54 +05:30
parent 62f578174b
commit 60947dab2b
18 changed files with 59 additions and 54 deletions

View File

@ -38,7 +38,7 @@ class IPAAuth(auth.AuthBase):
if self.keytab:
os.environ['KRB5_CLIENT_KTNAME'] = self.keytab
else:
LOG.warn(_LW('No IPA client kerberos keytab file given'))
LOG.warning(_LW('No IPA client kerberos keytab file given'))
def __call__(self, request):
if not self.token:

View File

@ -177,7 +177,7 @@ def syncipaservers2des(servers, designatereq, designateurl):
for srec in resp.json()['servers']:
dservers[srec['name']] = srec['id']
else:
LOG.warn(_LW("No servers in designate"))
LOG.warning(_LW("No servers in designate"))
# first - add servers from ipa not already in designate
for server in servers:

View File

@ -117,7 +117,7 @@ class RequestHandler(object):
serial = self.backend.find_zone_serial(zone_name)
if serial is not None:
LOG.warn(_LW("Not creating %(name)s, zone already exists") %
LOG.warning(_LW("Not creating %(name)s, zone already exists") %
{'name': zone_name})
# Provide an authoritative answer
response.flags |= dns.flags.AA
@ -161,7 +161,7 @@ class RequestHandler(object):
serial = self.backend.find_zone_serial(zone_name)
if serial is None:
LOG.warn(_LW("Refusing NOTIFY for %(name)s, doesn't exist") %
LOG.warning(_LW("Refusing NOTIFY for %(name)s, doesn't exist") %
{'name': zone_name})
response.set_rcode(dns.rcode.from_text("REFUSED"))
return response
@ -212,7 +212,7 @@ class RequestHandler(object):
serial = self.backend.find_zone_serial(zone_name)
if serial is None:
LOG.warn(_LW("Not deleting %(name)s, zone doesn't exist") %
LOG.warning(_LW("Not deleting %(name)s, zone doesn't exist") %
{'name': zone_name})
# Provide an authoritative answer
response.flags |= dns.flags.AA
@ -239,7 +239,7 @@ class RequestHandler(object):
return True
if requester not in self.allow_notify:
LOG.warn(_LW("%(verb)s for %(name)s from %(server)s refused") %
LOG.warning(_LW("%(verb)s for %(name)s from %(server)s refused") %
{'verb': op, 'name': zone_name, 'server': requester})
return False

View File

@ -215,7 +215,7 @@ class MaintenanceMiddleware(base.Middleware):
# If the caller has the bypass role, let them through
if ('context' in request.environ
and self.role in request.environ['context'].roles):
LOG.warn(_LW('Request authorized to bypass maintenance mode'))
LOG.warning(_LW('Request authorized to bypass maintenance mode'))
return None
# Otherwise, reject the request with a 503 Service Unavailable

View File

@ -127,7 +127,7 @@ class AgentPoolBackend(base.Backend):
dns_message, dest_ip, dest_port, timeout)
if isinstance(response, dns.exception.Timeout):
LOG.warn(_LW("Got Timeout while trying to send '%(msg)s' for "
LOG.warning(_LW("Got Timeout while trying to send '%(msg)s' for "
"'%(zone)s' to '%(server)s:%(port)d'. Timeout="
"'%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': str(opcode),
@ -136,7 +136,7 @@ class AgentPoolBackend(base.Backend):
'retry': retry})
response = None
elif isinstance(response, dns_query.BadResponse):
LOG.warn(_LW("Got BadResponse while trying to send '%(msg)s' "
LOG.warning(_LW("Got BadResponse while trying to send '%(msg)s' "
"for '%(zone)s' to '%(server)s:%(port)d'. Timeout"
"='%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': str(opcode),
@ -149,7 +149,7 @@ class AgentPoolBackend(base.Backend):
# authoritative answer
elif not (response.flags & dns.flags.AA) or dns.rcode.from_flags(
response.flags, response.ednsflags) != dns.rcode.NOERROR:
LOG.warn(_LW("Failed to get expected response while trying to "
LOG.warning(_LW("Failed to get expected response while trying to "
"send '%(msg)s' for '%(zone)s' to '%(server)s:"
"%(port)d'. Response message: %(resp)s") %
{'msg': str(opcode),

View File

@ -103,4 +103,4 @@ class DesignateBackend(base.Backend):
self.client.zones.delete(zone.name)
except exceptions.NotFound:
msg = _LW("Zone %s not found on remote Designate, Ignoring")
LOG.warn(msg, zone.id)
LOG.warning(msg, zone.id)

View File

@ -386,7 +386,7 @@ class DynECTBackend(base.Backend):
client.delete(url)
except DynClientError as e:
if e.http_status == 404:
LOG.warn(_LW("Attempt to delete %(d_id)s / %(d_name)s "
LOG.warning(_LW("Attempt to delete %(d_id)s / %(d_name)s "
"caused 404, ignoring.") %
{'d_id': zone['id'], 'd_name': zone['name']})
pass

View File

@ -53,8 +53,8 @@ def upgrade(migrate_engine):
'dns.records.ttl = designate.domains.ttl WHERE powerdns.records'
'.inherit_ttl = 1;')
LOG.warn(_LW('**** A manual post-migration step is required ****'))
LOG.warn(_LW('Please issue this query: %s' % pmq))
LOG.warning(_LW('**** A manual post-migration step is required ****'))
LOG.warning(_LW('Please issue this query: %s' % pmq))
def downgrade(migrate_engine):

View File

@ -29,7 +29,7 @@ meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
LOG.warn(_LW('It will not be possible to downgrade from schema #11'))
LOG.warning(_LW('It will not be possible to downgrade from schema #11'))
records_table = Table('records', meta, autoload=True)
records_table.c.designate_id.drop()

View File

@ -65,7 +65,7 @@ def _retry_on_deadlock(exc):
# TODO(kiall): This is a total leak of the SQLA Driver, we'll need a better
# way to handle this.
if isinstance(exc, db_exception.DBDeadlock):
LOG.warn(_LW("Deadlock detected. Retrying..."))
LOG.warning(_LW("Deadlock detected. Retrying..."))
return True
return False
@ -294,7 +294,7 @@ class Service(service.RPCService, service.Service):
if (cfg.CONF['service:central'].managed_resource_tenant_id ==
"00000000-0000-0000-0000-000000000000"):
msg = _LW("Managed Resource Tenant ID is not properly configured")
LOG.warn(msg)
LOG.warning(msg)
super(Service, self).start()

View File

@ -74,7 +74,7 @@ class CoordinationMixin(object):
msg = _LW("No coordination backend configured, distributed "
"coordination functionality will be disabled. "
"Please configure a coordination backend.")
LOG.warn(msg)
LOG.warning(msg)
super(CoordinationMixin, self).start()

View File

@ -132,7 +132,7 @@ class RequestHandler(xfr.XFRMixin):
if not master_addr:
msg = _LW("NOTIFY for %(name)s from non-master server "
"%(addr)s, ignoring.")
LOG.warn(msg % {"name": zone.name, "addr": notify_addr})
LOG.warning(msg % {"name": zone.name, "addr": notify_addr})
response.set_rcode(dns.rcode.REFUSED)
yield response
raise StopIteration

View File

@ -132,7 +132,7 @@ class NotifyEndpoint(base.BaseEndpoint):
if actual_serial is None or actual_serial < zone.serial:
# TODO(vinod): Account for serial number wrap around.
retries = retries - retry
LOG.warn(_LW("Got lower serial for '%(zone)s' to '%(host)s:"
LOG.warning(_LW("Got lower serial for '%(zone)s' to '%(host)s:"
"%(port)s'. Expected:'%(es)d'. Got:'%(as)s'."
"Retries left='%(retries)d'") %
{'zone': zone.name, 'host': host,
@ -186,25 +186,27 @@ class NotifyEndpoint(base.BaseEndpoint):
dns_message, host, port, timeout)
if isinstance(response, dns.exception.Timeout):
LOG.warn(_LW("Got Timeout while trying to send '%(msg)s' for "
"'%(zone)s' to '%(server)s:%(port)d'. Timeout="
"'%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'timeout': timeout,
'retry': retry})
LOG.warning(
_LW("Got Timeout while trying to send '%(msg)s' for "
"'%(zone)s' to '%(server)s:%(port)d'. Timeout="
"'%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'timeout': timeout,
'retry': retry})
response = None
# retry sending the message if we get a Timeout.
time.sleep(retry_interval)
continue
elif isinstance(response, dns_query.BadResponse):
LOG.warn(_LW("Got BadResponse while trying to send '%(msg)s' "
"for '%(zone)s' to '%(server)s:%(port)d'. Timeout"
"='%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'timeout': timeout,
'retry': retry})
LOG.warning(
_LW("Got BadResponse while trying to send '%(msg)s' "
"for '%(zone)s' to '%(server)s:%(port)d'. Timeout"
"='%(timeout)d' seconds. Retry='%(retry)d'") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'timeout': timeout,
'retry': retry})
response = None
break
# Check that we actually got a NOERROR in the rcode and and an
@ -217,12 +219,13 @@ class NotifyEndpoint(base.BaseEndpoint):
break
elif not (response.flags & dns.flags.AA) or dns.rcode.from_flags(
response.flags, response.ednsflags) != dns.rcode.NOERROR:
LOG.warn(_LW("Failed to get expected response while trying to "
"send '%(msg)s' for '%(zone)s' to '%(server)s:"
"%(port)d'.\nResponse message:\n%(resp)s\n") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'resp': str(response)})
LOG.warning(
_LW("Failed to get expected response while trying to "
"send '%(msg)s' for '%(zone)s' to '%(server)s:"
"%(port)d'.\nResponse message:\n%(resp)s\n") %
{'msg': 'NOTIFY' if notify else 'SOA',
'zone': zone.name, 'server': host,
'port': port, 'resp': str(response)})
response = None
break
else:

View File

@ -118,7 +118,7 @@ class NeutronNetworkAPI(NetworkAPI):
# NOTE: 401 might be that the user doesn't have neutron
# activated in a particular region, we'll just log the failure
# and go on with our lives.
LOG.warn(_LW("Calling Neutron resulted in a 401, "
LOG.warning(_LW("Calling Neutron resulted in a 401, "
"please investigate."))
LOG.exception(e)
return

View File

@ -272,7 +272,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
else:
LOG.warn(_LW('Consensus not reached for creating zone %(zone)s'
LOG.warning(_LW('Consensus not reached for creating zone %(zone)s'
' on pool targets') % {'zone': zone.name})
self.central_api.update_status(
@ -342,7 +342,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
success_count += 1
if not self._exceed_or_meet_threshold(success_count):
LOG.warn(_LW('Consensus not reached for updating zone %(zone)s'
LOG.warning(_LW('Consensus not reached for updating zone %(zone)s'
' on pool targets') % {'zone': zone.name})
self.central_api.update_status(context, zone.id, ERROR_STATUS,
zone.serial)
@ -430,7 +430,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
context, zone.id, SUCCESS_STATUS, zone.serial)
else:
LOG.warn(_LW('Consensus not reached for deleting zone %(zone)s'
LOG.warning(_LW('Consensus not reached for deleting zone %(zone)s'
' on pool targets') % {'zone': zone.name})
self.central_api.update_status(
@ -524,7 +524,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
error_serial = self._get_error_serial(
context, zone, consensus_serial)
if error_serial > consensus_serial or error_serial == 0:
LOG.warn(_LW('For zone %(zone)s '
LOG.warning(_LW('For zone %(zone)s '
'the error serial is %(error_serial)s.') %
{'zone': zone.name,
'error_serial': error_serial})
@ -532,7 +532,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
context, zone.id, ERROR_STATUS, error_serial)
if status == NO_ZONE_STATUS and action != DELETE_ACTION:
LOG.warn(_LW('Zone %(zone)s is not present in some '
LOG.warning(_LW('Zone %(zone)s is not present in some '
'targets') % {'zone': zone.name})
self.central_api.update_status(
context, zone.id, NO_ZONE_STATUS, 0)

View File

@ -267,17 +267,18 @@ class DNSService(object):
except socket.error as e:
client.close()
errname = errno.errorcode[e.args[0]]
LOG.warn(_LW("Socket error %(err)s from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1], 'err': errname})
LOG.warning(
_LW("Socket error %(err)s from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1], 'err': errname})
except socket.timeout:
client.close()
LOG.warn(_LW("TCP Timeout from: %(host)s:%(port)d") %
LOG.warning(_LW("TCP Timeout from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1]})
except struct.error:
client.close()
LOG.warn(_LW("Invalid packet from: %(host)s:%(port)d") %
LOG.warning(_LW("Invalid packet from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1]})
except Exception:
@ -308,8 +309,9 @@ class DNSService(object):
except socket.error as e:
errname = errno.errorcode[e.args[0]]
LOG.warn(_LW("Socket error %(err)s from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1], 'err': errname})
LOG.warning(
_LW("Socket error %(err)s from: %(host)s:%(port)d") %
{'host': addr[0], 'port': addr[1], 'err': errname})
except Exception:
LOG.exception(_LE("Unknown exception handling UDP request "

View File

@ -49,7 +49,7 @@ class Service(service.Service):
enabled_notification_handlers)
if len(notification_handlers) == 0:
LOG.warn(_LW('No designate-sink handlers enabled or loaded'))
LOG.warning(_LW('No designate-sink handlers enabled or loaded'))
return notification_handlers

View File

@ -90,7 +90,7 @@ def upgrade(migrate_engine):
# try again
msg = i18n._LW(
"Updating migration for sharding failed, retrying.")
LOG.warn(msg)
LOG.warning(msg)
if i >= 4:
# Raise if we've reached max attempts causing migration to
# fail