Merge "Change ramdisk log filename template"

This commit is contained in:
Jenkins 2017-08-01 15:27:43 +00:00 committed by Gerrit Code Review
commit ccd39bbcb4
3 changed files with 16 additions and 3 deletions

View File

@ -269,7 +269,7 @@ def get_ramdisk_logs_file_name(node):
:param node: A node object. :param node: A node object.
:returns: The log file name. :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] file_name_fields = [node.uuid]
if node.instance_uuid: if node.instance_uuid:
file_name_fields.append(node.instance_uuid) file_name_fields.append(node.instance_uuid)

View File

@ -260,7 +260,7 @@ class UtilsRamdiskLogsTestCase(tests_base.TestCase):
mock_utcnow.return_value = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = datetime.datetime(2000, 1, 1, 0, 0)
name = driver_utils.get_ramdisk_logs_file_name(self.node) name = driver_utils.get_ramdisk_logs_file_name(self.node)
expected_name = ('1be26c0b-03f2-4d2e-ae87-c02d7f33c123_' 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) self.assertEqual(expected_name, name)
# with instance_info # with instance_info
@ -269,7 +269,7 @@ class UtilsRamdiskLogsTestCase(tests_base.TestCase):
self.context, instance_uuid=instance_uuid) self.context, instance_uuid=instance_uuid)
name = driver_utils.get_ramdisk_logs_file_name(node2) name = driver_utils.get_ramdisk_logs_file_name(node2)
expected_name = ('1be26c0b-03f2-4d2e-ae87-c02d7f33c123_' + 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) self.assertEqual(expected_name, name)
@mock.patch.object(driver_utils, 'store_ramdisk_logs', autospec=True) @mock.patch.object(driver_utils, 'store_ramdisk_logs', autospec=True)

View File

@ -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.