Changes log level of a message

This fix changes the log level of a message to 'info'. The message
is related to deletion of swift temporary object when object is not
found on the swift. The swift temporary object being attempted for
delete has a expiration time hence this message need not be of
'warning' level.

Change-Id: I7ac52bd0e1ef61d35722dce352e6bc1844d3d2d2
Closes-Bug: #1629286
This commit is contained in:
Shivanand Tendulker 2017-06-23 06:01:02 -04:00 committed by Ruby Loo
parent f0e6a07ade
commit 8a73b344f3
3 changed files with 14 additions and 7 deletions

View File

@ -183,11 +183,11 @@ def remove_image_from_swift(object_name, associated_with=None):
swift_api = swift.SwiftAPI()
swift_api.delete_object(container, object_name)
except exception.SwiftObjectNotFoundError as e:
LOG.warning("Temporary object %(associated_with_msg)s"
"was already deleted from Swift. Error: %(err)s",
{'associated_with_msg':
("associated with %s " % associated_with
if associated_with else ""), 'err': e})
LOG.info("Temporary object %(associated_with_msg)s"
"was already deleted from Swift. Error: %(err)s",
{'associated_with_msg':
("associated with %s " % associated_with
if associated_with else ""), 'err': e})
except exception.SwiftOperationError as e:
LOG.exception("Error while deleting temporary swift object "
"%(object_name)s %(associated_with_msg)s from "

View File

@ -636,7 +636,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
self.assertTrue(log_mock.called)
eject_mock.assert_called_once_with(task)
@mock.patch.object(ilo_common.LOG, 'warning', spec_set=True,
@mock.patch.object(ilo_common.LOG, 'info', spec_set=True,
autospec=True)
@mock.patch.object(ilo_common, 'eject_vmedia_devices',
spec_set=True, autospec=True)
@ -921,7 +921,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
# | WHEN |
ilo_common.remove_image_from_swift(object_name)
# | THEN |
LOG_mock.warning.assert_called_once_with(
LOG_mock.info.assert_called_once_with(
mock.ANY, {'associated_with_msg': "", 'err': raised_exc})
@mock.patch.object(ilo_common, 'LOG', spec_set=True, autospec=True)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
When the deletion of a swift temporary object fails because the
object is no longer available in swift, a message is logged.
The log level of this message was changed from ``warning`` to
``info``.