Cut down on warning logs
- don't log on ignore_not_found() - drop some logs from warn to info - remove the "no resources in template" log - remove the "Duplicating event" log Change-Id: Ie4d68b43607336c8c054a32126d6a05ba4e5e15c Closes-bug: #1346755
This commit is contained in:
parent
78a6757d88
commit
f94db70b71
|
@ -87,9 +87,6 @@ class Event(object):
|
|||
if self.timestamp is not None:
|
||||
ev['created_at'] = self.timestamp
|
||||
|
||||
if self.id is not None:
|
||||
LOG.warning(_('Duplicating event'))
|
||||
|
||||
new_ev = db_api.event_create(self.context, ev)
|
||||
self.id = new_ev.id
|
||||
return self.id
|
||||
|
|
|
@ -71,7 +71,6 @@ class ElasticIp(resource.Resource):
|
|||
ips = self.neutron().show_floatingip(self.resource_id)
|
||||
except Exception as ex:
|
||||
self.client_plugin('neutron').ignore_not_found(ex)
|
||||
LOG.warn(_("Floating IPs not found"))
|
||||
else:
|
||||
self.ipaddress = ips['floatingip']['floating_ip_address']
|
||||
else:
|
||||
|
@ -79,7 +78,6 @@ class ElasticIp(resource.Resource):
|
|||
ips = self.nova().floating_ips.get(self.resource_id)
|
||||
except Exception as e:
|
||||
self.client_plugin('nova').ignore_not_found(e)
|
||||
LOG.warn(_("Floating IPs not found"))
|
||||
else:
|
||||
self.ipaddress = ips.ip
|
||||
return self.ipaddress or ''
|
||||
|
@ -187,7 +185,7 @@ class ElasticIpAssociation(resource.Resource):
|
|||
|
||||
if self.properties[self.EIP]:
|
||||
if not self.properties[self.INSTANCE_ID]:
|
||||
LOG.warn(_('Skipping association, InstanceId not specified'))
|
||||
LOG.debug('Skipping association, InstanceId not specified')
|
||||
return
|
||||
server = self.nova().servers.get(self.properties[self.INSTANCE_ID])
|
||||
server.add_floating_ip(self.properties[self.EIP])
|
||||
|
@ -208,7 +206,7 @@ class ElasticIpAssociation(resource.Resource):
|
|||
port_rsrc = ports['ports'][0]
|
||||
port_id = port_rsrc['id']
|
||||
else:
|
||||
LOG.warn(_('Skipping association, resource not specified'))
|
||||
LOG.debug('Skipping association, resource not specified')
|
||||
return
|
||||
|
||||
float_id = self.properties[self.ALLOCATION_ID]
|
||||
|
|
|
@ -119,7 +119,6 @@ class NeutronResource(resource.Resource):
|
|||
attributes = self._show_resource()
|
||||
except Exception as ex:
|
||||
self.client_plugin().ignore_not_found(ex)
|
||||
LOG.warn(_("failed to fetch resource attributes: %s") % ex)
|
||||
return None
|
||||
if name == 'show':
|
||||
return attributes
|
||||
|
|
|
@ -308,7 +308,6 @@ class OSDBInstance(resource.Resource):
|
|||
instance = self.trove().instances.get(self.resource_id)
|
||||
except Exception as ex:
|
||||
self.client_plugin().ignore_not_found(ex)
|
||||
LOG.debug("Database instance %s not found." % self.resource_id)
|
||||
else:
|
||||
instance.delete()
|
||||
return instance
|
||||
|
|
|
@ -629,7 +629,6 @@ class Server(stack_user.StackUser):
|
|||
server = self.nova().servers.get(self.resource_id)
|
||||
except Exception as e:
|
||||
self.client_plugin().ignore_not_found(e)
|
||||
LOG.warn(_('Instance (%s) not found') % self.resource_id)
|
||||
return ''
|
||||
if name == self.ADDRESSES:
|
||||
return self._add_port_for_address(server)
|
||||
|
|
|
@ -76,20 +76,20 @@ class User(stack_user.StackUser):
|
|||
# ignore the policy (don't reject it because we previously ignored
|
||||
# and we don't want to break templates which previously worked
|
||||
if not isinstance(policy, basestring):
|
||||
LOG.warning(_("Ignoring policy %s, must be string "
|
||||
"resource name") % policy)
|
||||
LOG.debug("Ignoring policy %s, must be string "
|
||||
"resource name" % policy)
|
||||
continue
|
||||
|
||||
try:
|
||||
policy_rsrc = self.stack[policy]
|
||||
except KeyError:
|
||||
LOG.error(_("Policy %(policy)s does not exist in stack "
|
||||
"%(stack)s")
|
||||
LOG.debug("Policy %(policy)s does not exist in stack "
|
||||
"%(stack)s"
|
||||
% {'policy': policy, 'stack': self.stack.name})
|
||||
return False
|
||||
|
||||
if not callable(getattr(policy_rsrc, 'access_allowed', None)):
|
||||
LOG.error(_("Policy %s is not an AccessPolicy resource")
|
||||
LOG.debug("Policy %s is not an AccessPolicy resource"
|
||||
% policy)
|
||||
return False
|
||||
|
||||
|
@ -115,8 +115,8 @@ class User(stack_user.StackUser):
|
|||
policies = (self.properties[self.POLICIES] or [])
|
||||
for policy in policies:
|
||||
if not isinstance(policy, basestring):
|
||||
LOG.warning(_("Ignoring policy %s, must be string "
|
||||
"resource name") % policy)
|
||||
LOG.debug("Ignoring policy %s, must be string "
|
||||
"resource name" % policy)
|
||||
continue
|
||||
policy_rsrc = self.stack[policy]
|
||||
if not policy_rsrc.access_allowed(resource_name):
|
||||
|
@ -212,7 +212,7 @@ class AccessKey(resource.Resource):
|
|||
|
||||
user = self._get_user()
|
||||
if user is None:
|
||||
LOG.warning(_('Error deleting %s - user not found') % str(self))
|
||||
LOG.debug('Error deleting %s - user not found' % str(self))
|
||||
return
|
||||
user._delete_keypair()
|
||||
|
||||
|
@ -222,7 +222,7 @@ class AccessKey(resource.Resource):
|
|||
'''
|
||||
if self._secret is None:
|
||||
if not self.resource_id:
|
||||
LOG.warn(_('could not get secret for %(username)s '
|
||||
LOG.info(_('could not get secret for %(username)s '
|
||||
'Error:%(msg)s')
|
||||
% {'username': self.properties[self.USER_NAME],
|
||||
'msg': "resource_id not yet set"})
|
||||
|
@ -242,7 +242,7 @@ class AccessKey(resource.Resource):
|
|||
# And the ID of the v3 credential
|
||||
self.data_set('credential_id', kp.id, redact=True)
|
||||
except Exception as ex:
|
||||
LOG.warn(_('could not get secret for %(username)s '
|
||||
LOG.info(_('could not get secret for %(username)s '
|
||||
'Error:%(msg)s') % {
|
||||
'username': self.properties[self.USER_NAME],
|
||||
'msg': ex})
|
||||
|
@ -291,7 +291,6 @@ class AccessPolicy(resource.Resource):
|
|||
for resource in resources:
|
||||
if resource not in self.stack:
|
||||
msg = _("AccessPolicy resource %s not in stack") % resource
|
||||
LOG.error(msg)
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
||||
def access_allowed(self, resource_name):
|
||||
|
|
|
@ -157,7 +157,6 @@ class Volume(resource.Resource):
|
|||
vol.get()
|
||||
|
||||
if vol.status == 'in-use':
|
||||
LOG.warn(_('can not delete volume when in-use'))
|
||||
raise exception.Error(_('Volume in use'))
|
||||
|
||||
vol.delete()
|
||||
|
@ -322,8 +321,6 @@ class VolumeDetachTask(object):
|
|||
if (cinder_plugin.is_not_found(ex) or
|
||||
nova_plugin.is_not_found(ex) or
|
||||
nova_plugin.is_bad_request(ex)):
|
||||
|
||||
LOG.warning(_('%s - volume not found') % str(self))
|
||||
return
|
||||
else:
|
||||
raise
|
||||
|
@ -332,10 +329,8 @@ class VolumeDetachTask(object):
|
|||
try:
|
||||
server_api.delete_server_volume(self.server_id, self.attachment_id)
|
||||
except Exception as ex:
|
||||
if (nova_plugin.is_not_found(ex) or
|
||||
nova_plugin.is_bad_request(ex)):
|
||||
LOG.warning(_('%(res)s - %(err)s') % {'res': str(self),
|
||||
'err': ex})
|
||||
if nova_plugin.is_not_found(ex) or nova_plugin.is_bad_request(ex):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
@ -354,7 +349,6 @@ class VolumeDetachTask(object):
|
|||
|
||||
except Exception as ex:
|
||||
cinder_plugin.ignore_not_found(ex)
|
||||
LOG.warning(_('%s - volume not found') % str(self))
|
||||
|
||||
# The next check is needed for immediate reattachment when updating:
|
||||
# there might be some time between cinder marking volume as 'available'
|
||||
|
|
|
@ -573,7 +573,7 @@ class EngineService(service.Service):
|
|||
# Schedule a periodic watcher task for this stack
|
||||
self.stack_watch.start_watch_task(stack.id, cnxt)
|
||||
else:
|
||||
LOG.warning(_("Stack create failed, status %s") % stack.status)
|
||||
LOG.info(_("Stack create failed, status %s") % stack.status)
|
||||
|
||||
stack = self._parse_template_and_validate_stack(cnxt,
|
||||
stack_name,
|
||||
|
|
|
@ -219,13 +219,7 @@ class Template(collections.Mapping):
|
|||
raise exception.InvalidTemplateSection(section=k)
|
||||
|
||||
# check resources
|
||||
tmpl_resources = self[self.RESOURCES]
|
||||
if len(tmpl_resources) == 0:
|
||||
LOG.warn(_('Template does not contain any resources, so '
|
||||
'the template would not really do anything when '
|
||||
'being instantiated.'))
|
||||
|
||||
for res in tmpl_resources.values():
|
||||
for res in self[self.RESOURCES].values():
|
||||
try:
|
||||
if not res.get('Type'):
|
||||
message = _('Every Resource object must '
|
||||
|
|
Loading…
Reference in New Issue