Remove trailing newline character in UUID
Trailing newline character is present in UUID returned by _get_system_uuid method. This causes problems when the returned UUID is not checked for newline. Remove trailing newline before returning UUID. Change-Id: Ibe37a14f67ce7452f088d7913a76c6233202ccea Closes-Bug: #1819062
This commit is contained in:
parent
c88071dc19
commit
a2b72a967f
os_brick
@ -61,7 +61,7 @@ class NVMeConnector(base.BaseLinuxConnector):
|
||||
LOG.debug("Unable to locate dmidecode. For Cinder RSD Backend,"
|
||||
" please make sure it is installed: %s", e)
|
||||
out = ""
|
||||
return out
|
||||
return out.strip()
|
||||
|
||||
@staticmethod
|
||||
def get_connector_properties(root_helper, *args, **kwargs):
|
||||
|
@ -40,6 +40,14 @@ class NVMeConnectorTestCase(test_connector.ConnectorTestCase):
|
||||
self.connector = nvme.NVMeConnector(None,
|
||||
execute=self.fake_execute)
|
||||
|
||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
||||
def test_get_sysuuid_without_newline(self, mock_execute):
|
||||
mock_execute.return_value = (
|
||||
"9126E942-396D-11E7-B0B7-A81E84C186D1\n", "")
|
||||
uuid = self.connector._get_system_uuid()
|
||||
expected_uuid = "9126E942-396D-11E7-B0B7-A81E84C186D1"
|
||||
self.assertEqual(expected_uuid, uuid)
|
||||
|
||||
@mock.patch.object(nvme.NVMeConnector, '_execute')
|
||||
def test_get_connector_properties_without_sysuuid(
|
||||
self, mock_execute):
|
||||
|
Loading…
x
Reference in New Issue
Block a user