diff --git a/ironic/drivers/utils.py b/ironic/drivers/utils.py index 65902bf031..860a89922a 100644 --- a/ironic/drivers/utils.py +++ b/ironic/drivers/utils.py @@ -269,7 +269,7 @@ def get_ramdisk_logs_file_name(node): :param node: A node object. :returns: The log file name. """ - timestamp = timeutils.utcnow().strftime('%Y-%m-%d-%H:%M:%S') + timestamp = timeutils.utcnow().strftime('%Y-%m-%d-%H-%M-%S') file_name_fields = [node.uuid] if node.instance_uuid: file_name_fields.append(node.instance_uuid) diff --git a/ironic/tests/unit/drivers/test_utils.py b/ironic/tests/unit/drivers/test_utils.py index c0952bf078..4a1bc7f94b 100644 --- a/ironic/tests/unit/drivers/test_utils.py +++ b/ironic/tests/unit/drivers/test_utils.py @@ -260,7 +260,7 @@ class UtilsRamdiskLogsTestCase(tests_base.TestCase): mock_utcnow.return_value = datetime.datetime(2000, 1, 1, 0, 0) name = driver_utils.get_ramdisk_logs_file_name(self.node) expected_name = ('1be26c0b-03f2-4d2e-ae87-c02d7f33c123_' - '2000-01-01-00:00:00.tar.gz') + '2000-01-01-00-00-00.tar.gz') self.assertEqual(expected_name, name) # with instance_info @@ -269,7 +269,7 @@ class UtilsRamdiskLogsTestCase(tests_base.TestCase): self.context, instance_uuid=instance_uuid) name = driver_utils.get_ramdisk_logs_file_name(node2) expected_name = ('1be26c0b-03f2-4d2e-ae87-c02d7f33c123_' + - instance_uuid + '_2000-01-01-00:00:00.tar.gz') + instance_uuid + '_2000-01-01-00-00-00.tar.gz') self.assertEqual(expected_name, name) @mock.patch.object(driver_utils, 'store_ramdisk_logs', autospec=True) diff --git a/releasenotes/notes/change-ramdisk-log-filename-142b10d0b02a5ca6.yaml b/releasenotes/notes/change-ramdisk-log-filename-142b10d0b02a5ca6.yaml new file mode 100644 index 0000000000..9f14507dea --- /dev/null +++ b/releasenotes/notes/change-ramdisk-log-filename-142b10d0b02a5ca6.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + Changes timestamp part of ramdisk log filename by replacing + colon with dash. The ``tar`` command does not handle colon + properly, and untar of the file with colon in filename will + fail. +fixes: + - | + Changes timestamp part of ramdisk log filename by replacing + colon with dash. The ``tar`` command does not handle colon + properly, and untar of the file with colon in filename will + fail.