summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-02-12 15:10:25 -0700
committerChad Smith <chad.smith@canonical.com>2018-02-12 15:10:25 -0700
commit42923ffbbf6a84819224417f0e032497af60d0cd (patch)
tree0fd47e7f95b5059d42355ca5a66df6477a8b5e34 /tests/unittests
parent754f54037aca0f604b8b57ab71b30dad5e5066cf (diff)
downloadvyos-cloud-init-42923ffbbf6a84819224417f0e032497af60d0cd.tar.gz
vyos-cloud-init-42923ffbbf6a84819224417f0e032497af60d0cd.zip
ds-identify: check /writable/system-data/ for nocloud seed.
Ubuntu core seeds information to nocloud via a bind-mount of /writable/system-data/var/lib/cloud over /var/lib/cloud. When ds-identify runs as a systemd generator that mount is not guaranteed to have been done. It is guaranteed at cloud-init-local.service time, but not generator time. Images built with 'ubuntu-image --cloud-init=user-data-file' would have cloud-init disabled. The fix here is just to consider the seed dir under /writable/system-data. LP: #1747070
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_ds_identify.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
index 31cc6223..03942de0 100644
--- a/tests/unittests/test_ds_identify.py
+++ b/tests/unittests/test_ds_identify.py
@@ -359,6 +359,14 @@ class TestDsIdentify(CiTestCase):
"""NoCloud is found with iso9660 filesystem on non-cdrom disk."""
self._test_ds_found('NoCloud')
+ def test_nocloud_seed(self):
+ """Nocloud seed directory."""
+ self._test_ds_found('NoCloud-seed')
+
+ def test_nocloud_seed_ubuntu_core_writable(self):
+ """Nocloud seed directory ubuntu core writable"""
+ self._test_ds_found('NoCloud-seed-ubuntu-core')
+
def blkid_out(disks=None):
"""Convert a list of disk dictionaries into blkid content."""
@@ -454,6 +462,22 @@ VALID_CFG = {
'dev/vdb': 'pretend iso content for cidata\n',
}
},
+ 'NoCloud-seed': {
+ 'ds': 'NoCloud',
+ 'files': {
+ os.path.join(P_SEED_DIR, 'nocloud', 'user-data'): 'ud\n',
+ os.path.join(P_SEED_DIR, 'nocloud', 'meta-data'): 'md\n',
+ }
+ },
+ 'NoCloud-seed-ubuntu-core': {
+ 'ds': 'NoCloud',
+ 'files': {
+ os.path.join('writable/system-data', P_SEED_DIR,
+ 'nocloud-net', 'user-data'): 'ud\n',
+ os.path.join('writable/system-data', P_SEED_DIR,
+ 'nocloud-net', 'meta-data'): 'md\n',
+ }
+ },
'OpenStack': {
'ds': 'OpenStack',
'files': {P_PRODUCT_NAME: 'OpenStack Nova\n'},