From 8a73b344f3d39d57f30f1d1ff4d778ba0ce37eb2 Mon Sep 17 00:00:00 2001 From: Shivanand Tendulker Date: Fri, 23 Jun 2017 06:01:02 -0400 Subject: [PATCH] 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 --- ironic/drivers/modules/ilo/common.py | 10 +++++----- ironic/tests/unit/drivers/modules/ilo/test_common.py | 4 ++-- .../fix-ilo-drivers-log-message-c3c64c1ca0a0bca8.yaml | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/fix-ilo-drivers-log-message-c3c64c1ca0a0bca8.yaml diff --git a/ironic/drivers/modules/ilo/common.py b/ironic/drivers/modules/ilo/common.py index 5cd65b91bc..bc78e189d7 100644 --- a/ironic/drivers/modules/ilo/common.py +++ b/ironic/drivers/modules/ilo/common.py @@ -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 " diff --git a/ironic/tests/unit/drivers/modules/ilo/test_common.py b/ironic/tests/unit/drivers/modules/ilo/test_common.py index 80bf84d0d4..56cb290fc1 100644 --- a/ironic/tests/unit/drivers/modules/ilo/test_common.py +++ b/ironic/tests/unit/drivers/modules/ilo/test_common.py @@ -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) diff --git a/releasenotes/notes/fix-ilo-drivers-log-message-c3c64c1ca0a0bca8.yaml b/releasenotes/notes/fix-ilo-drivers-log-message-c3c64c1ca0a0bca8.yaml new file mode 100644 index 0000000000..6cf8e75447 --- /dev/null +++ b/releasenotes/notes/fix-ilo-drivers-log-message-c3c64c1ca0a0bca8.yaml @@ -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``.