From b7497e807fa12a26d4a12aaf1ee9302a4fd24728 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 21 Feb 2018 16:09:14 -0500 Subject: ds-identify: Fix searching for iso9660 OVF cdroms. This fixes a bug in parsing of 'blkid -o export' output. The result of the bug meant that DI_ISO9660_DEVS did not get set correctly and is_cdrom_ovf would not identify devices in most cases. The tests are improved to demonstrate both multiple iso devices and also a cdrom that doesn't sort "last" in blkid output. The code change is to use DEVNAME as the record separator when parsing blkid -o export rather than relying on being able to read the empty line. LP: #1749980 --- tests/unittests/test_ds_identify.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py index 03942de0..21258347 100644 --- a/tests/unittests/test_ds_identify.py +++ b/tests/unittests/test_ds_identify.py @@ -350,8 +350,10 @@ class TestDsIdentify(CiTestCase): "OVFENV", "ovfenv"] for valid_ovf_label in valid_ovf_labels: ovf_cdrom_by_label['mocks'][0]['out'] = blkid_out([ + {'DEVNAME': 'sda1', 'TYPE': 'ext4', 'LABEL': 'rootfs'}, {'DEVNAME': 'sr0', 'TYPE': 'iso9660', - 'LABEL': valid_ovf_label}]) + 'LABEL': valid_ovf_label}, + {'DEVNAME': 'vda1', 'TYPE': 'ntfs', 'LABEL': 'data'}]) self._check_via_dict( ovf_cdrom_by_label, rc=RC_FOUND, dslist=['OVF', DS_NONE]) @@ -513,8 +515,9 @@ VALID_CFG = { 'mocks': [ {'name': 'blkid', 'ret': 0, 'out': blkid_out( - [{'DEVNAME': 'vda1', 'TYPE': 'vfat', 'PARTUUID': uuid4()}, - {'DEVNAME': 'sr0', 'TYPE': 'iso9660', 'LABEL': ''}]) + [{'DEVNAME': 'sr0', 'TYPE': 'iso9660', 'LABEL': ''}, + {'DEVNAME': 'sr1', 'TYPE': 'iso9660', 'LABEL': 'ignoreme'}, + {'DEVNAME': 'vda1', 'TYPE': 'vfat', 'PARTUUID': uuid4()}]), }, MOCK_VIRT_IS_VMWARE, ], -- cgit v1.2.3