summaryrefslogtreecommitdiff
path: root/tests/unittests/test_ds_identify.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-05-18 13:19:14 -0400
committerScott Moser <smoser@brickies.net>2017-05-24 13:54:05 -0400
commit13673f8d2b815452aa22f8e3811e04481558a731 (patch)
tree38fe0b465904794309cde77d2e5345c98c96c799 /tests/unittests/test_ds_identify.py
parent6b5369be71054a677b89fa8080f7ddd029ce4986 (diff)
downloadvyos-cloud-init-13673f8d2b815452aa22f8e3811e04481558a731.tar.gz
vyos-cloud-init-13673f8d2b815452aa22f8e3811e04481558a731.zip
fix tools/ds-identify to not write None twice.
If the user configured: datasource_list: ["Ec2", "None"] then ds-identify would write datasource_list: ["Ec2", "None", "None"] which would break the logic to avoid warning.
Diffstat (limited to 'tests/unittests/test_ds_identify.py')
-rw-r--r--tests/unittests/test_ds_identify.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
index 9e148852..8559e1fe 100644
--- a/tests/unittests/test_ds_identify.py
+++ b/tests/unittests/test_ds_identify.py
@@ -210,6 +210,13 @@ class TestDsIdentify(CiTestCase):
mydata['files'][cfgpath] = 'datasource_list: ["NoCloud"]\n'
self._check_via_dict(mydata, rc=RC_FOUND, dslist=['NoCloud', DS_NONE])
+ def test_configured_list_with_none(self):
+ """If user set a datasource_list, that should be used."""
+ mydata = copy.deepcopy(VALID_CFG['GCE'])
+ cfgpath = 'etc/cloud/cloud.cfg.d/myds.cfg'
+ mydata['files'][cfgpath] = 'datasource_list: ["Ec2", "None"]\n'
+ self._check_via_dict(mydata, rc=RC_FOUND, dslist=['Ec2', DS_NONE])
+
def blkid_out(disks=None):
"""Convert a list of disk dictionaries into blkid content."""