Restore blkid compatibility with Centos 7

The blkid version included in util-linux 2.23.2 does not allow long
options name for probe and match-tag.
Use the short single letter name to restore compatibility with Centos 7

Story: 2009328
Task: 43764

Change-Id: I10a52c16ebe4e519d0af63b36c3a89fd5d371319
This commit is contained in:
Riccardo Pittau 2021-11-15 11:11:08 +01:00
parent 6260807d51
commit 731e2f9c82
3 changed files with 9 additions and 5 deletions

View File

@ -191,9 +191,9 @@ def get_partition_table_type(device):
def _blkid(device, probe=False, fields=None):
args = []
if probe:
args.append('--probe')
args.append('-p')
if fields:
args += sum((['--match-tag', field] for field in fields), [])
args += sum((['-s', field] for field in fields), [])
output, err = utils.execute('blkid', device, *args,
use_standard_locale=True, run_as_root=True)

View File

@ -928,7 +928,7 @@ class GetDeviceInformationTestCase(base.IronicLibTestCase):
mock_execute.return_value = BLKID_PROBE, ""
result = disk_utils.get_device_information('/dev/fake', probe=True)
self.assertEqual({'PTUUID': '123456', 'PTTYPE': 'gpt'}, result)
mock_execute.assert_called_once_with('blkid', '/dev/fake', '--probe',
mock_execute.assert_called_once_with('blkid', '/dev/fake', '-p',
use_standard_locale=True,
run_as_root=True)
@ -952,8 +952,7 @@ class GetDeviceInformationTestCase(base.IronicLibTestCase):
result = disk_utils.get_device_information('/dev/fake', probe=True)
self.assertEqual({}, result)
mock_execute.assert_called_once_with('blkid', '/dev/fake',
'--probe',
use_standard_locale=True,
'-p', use_standard_locale=True,
run_as_root=True)

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Restore compatibility of blkid command with CentOS 7. For more details
see `Story 2009328 <https://storyboard.openstack.org/#!/story/2009328>`_.