Merge "Changes log level of a message"

This commit is contained in:
Jenkins 2017-07-31 11:54:50 +00:00 committed by Gerrit Code Review
commit 1d1f2d92a8
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``.