cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #02260
Re: [Merge] ~smoser/cloud-init:bug/1683038-ec2-no-warn-on-explicit into cloud-init:master
some responses in line. i'll fix some things too. thanks for review.
Diff comments:
> diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
> index 2f9c7ed..818a639 100644
> --- a/cloudinit/sources/DataSourceEc2.py
> +++ b/cloudinit/sources/DataSourceEc2.py
> @@ -266,6 +267,12 @@ def parse_strict_mode(cfgval):
> return mode, sleep
>
>
> +def _is_explicit_dslist(dslist):
sure. I will fix.
bikeshed response: it is in the DataSourceEc2 module :)
> + if 'Ec2' not in dslist:
We do not support case insensitivity.
the string in datasource_list is passed to loading modules. it could definitely be improved. but for now not supported.
if datasource_list is not a list, then this module will never be loaded.
> + return False
> + return (len(dslist) == 1 or (len(dslist) == 2 and 'None' in dslist))
> +
> +
> def warn_if_necessary(cfgval, cfg):
> try:
> mode, sleep = parse_strict_mode(cfgval)
> diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
> index 9e14885..8559e1f 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."""
well, sort of.
It does that, but it also checks that if you put ['Ec2', 'None'],
then you get Ec2 used even if the data ('GCE') would pick a different cloud.
Ie, explicit user configuration of one entry or 2 including None is explicit setting.
> + 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."""
--
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/324274
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:bug/1683038-ec2-no-warn-on-explicit into cloud-init:master.
References