← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel

 

Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel.

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1737704 in cloud-init: "Cloud-init fails if iso9660 filesystem on non-cdrom path in 20171211 image."
  https://bugs.launchpad.net/cloud-init/+bug/1737704

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/335099

Upstream snapshot of master for Bionic (ubuntu/devel)
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel.
diff --git a/debian/changelog b/debian/changelog
index 993bdff..c07ed7e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+cloud-init (17.1-60-ga30a3bb5-0ubuntu1) bionic; urgency=medium
+
+  * New upstream snapshot.
+    - ds-identify: failure in NoCloud due to unset variable usage.
+      (LP: #1737704)
+    - tests: fix collect_console when not implemented [Joshua Powers]
+
+ -- Chad Smith <chad.smith@xxxxxxxxxxxxx>  Tue, 12 Dec 2017 12:03:08 -0700
+
 cloud-init (17.1-58-g703241a3-0ubuntu1) bionic; urgency=medium
 
   * New upstream snapshot.
diff --git a/tests/cloud_tests/collect.py b/tests/cloud_tests/collect.py
index 4805cea..bb72245 100644
--- a/tests/cloud_tests/collect.py
+++ b/tests/cloud_tests/collect.py
@@ -31,8 +31,8 @@ def collect_console(instance, base_dir):
     LOG.debug('getting console log')
     try:
         data = instance.console_log()
-    except NotImplementedError as e:
-        data = 'Not Implemented: %s' % e
+    except NotImplementedError:
+        data = b'instance.console_log: not implemented'
     with open(os.path.join(base_dir, 'console.log'), "wb") as fp:
         fp.write(data)
 
diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
index 3f1a671..c9234ed 100644
--- a/tests/unittests/test_ds_identify.py
+++ b/tests/unittests/test_ds_identify.py
@@ -27,6 +27,14 @@ TYPE=ext4
 PARTUUID=30c65c77-e07d-4039-b2fb-88b1fb5fa1fc
 """
 
+# this is a Ubuntu 18.04 disk.img output (dual uefi and bios bootable)
+BLKID_UEFI_UBUNTU = [
+    {'DEVNAME': 'vda1', 'TYPE': 'ext4', 'PARTUUID': uuid4(), 'UUID': uuid4()},
+    {'DEVNAME': 'vda14', 'PARTUUID': uuid4()},
+    {'DEVNAME': 'vda15', 'TYPE': 'vfat', 'LABEL': 'UEFI', 'PARTUUID': uuid4(),
+     'UUID': '5F55-129B'}]
+
+
 POLICY_FOUND_ONLY = "search,found=all,maybe=none,notfound=disabled"
 POLICY_FOUND_OR_MAYBE = "search,found=all,maybe=all,notfound=disabled"
 DI_DEFAULT_POLICY = "search,found=all,maybe=all,notfound=enabled"
@@ -340,6 +348,10 @@ class TestDsIdentify(CiTestCase):
             self._check_via_dict(
                 ovf_cdrom_by_label, rc=RC_FOUND, dslist=['OVF', DS_NONE])
 
+    def test_default_nocloud_as_vdb_iso9660(self):
+        """NoCloud is found with iso9660 filesystem on non-cdrom disk."""
+        self._test_ds_found('NoCloud')
+
 
 def blkid_out(disks=None):
     """Convert a list of disk dictionaries into blkid content."""
@@ -422,6 +434,19 @@ VALID_CFG = {
         'files': {P_PRODUCT_SERIAL: 'GoogleCloud-8f2e88f\n'},
         'mocks': [MOCK_VIRT_IS_KVM],
     },
+    'NoCloud': {
+        'ds': 'NoCloud',
+        'mocks': [
+            MOCK_VIRT_IS_KVM,
+            {'name': 'blkid', 'ret': 0,
+             'out': blkid_out(
+                 BLKID_UEFI_UBUNTU +
+                 [{'DEVNAME': 'vdb', 'TYPE': 'iso9660', 'LABEL': 'cidata'}])},
+        ],
+        'files': {
+            'dev/vdb': 'pretend iso content for cidata\n',
+        }
+    },
     'OpenStack': {
         'ds': 'OpenStack',
         'files': {P_PRODUCT_NAME: 'OpenStack Nova\n'},
diff --git a/tools/ds-identify b/tools/ds-identify
index 4c59d7b..5893a76 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -657,7 +657,7 @@ is_cdrom_ovf() {
     # skip devices that don't look like cdrom paths.
     case "$dev" in
         /dev/sr[0-9]|/dev/hd[a-z]) :;;
-        *) debug 1 "skipping iso dev $d"
+        *) debug 1 "skipping iso dev $dev"
            return 1;;
     esac
 
@@ -666,7 +666,7 @@ is_cdrom_ovf() {
 
     # explicitly skip known labels of other types. rd_rdfe is azure.
     case "$label" in
-        config-2|rd_rdfe_stable*) return 1;;
+        config-2|rd_rdfe_stable*|cidata) return 1;;
     esac
 
     local idstr="http://schemas.dmtf.org/ovf/environment/1";

Follow ups