cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05285
Re: [Merge] ~mgerdts/cloud-init:lp1765801 into cloud-init:master
Thanks for the branch Mike, just a request for unit test or an additional assert on the SmartOs datasource update_events attribute as well as what seems to be a git rebase required on your branch.
Diff comments:
> diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py
> index f92e8b5..ed4bc18 100644
> --- a/cloudinit/sources/DataSourceSmartOS.py
> +++ b/cloudinit/sources/DataSourceSmartOS.py
> @@ -178,6 +179,7 @@ class DataSourceSmartOS(sources.DataSource):
> self.metadata = {}
> self.network_data = None
> self._network_config = None
> + self.update_events['network'].add(EventType.BOOT)
May be worth a trivial unit test in tests/unittests/test_datasource/test_smartos.py (or an additional assert to an existing unit test) which asserts that update_events is a set containing EventType.BOOT.
>
> self.script_base_d = os.path.join(self.paths.get_cpath("scripts"))
>
> diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
> index 16be569..f424316 100644
> --- a/cloudinit/sources/__init__.py
> +++ b/cloudinit/sources/__init__.py
> @@ -103,14 +103,14 @@ class DataSource(object):
> url_timeout = 10 # timeout for each metadata url read attempt
> url_retries = 5 # number of times to retry url upon 404
>
> - # The datasource defines a set of supported EventTypes during which
> + # The datasource defines a list of supported EventTypes during which
I think all changes to cloudinit/sources/__init__.py are representation that your branch is out of sync with tip of master, as update_events got changed to be a set instead of list, and the debug log about 'not updated for events' should still be emitted. I think a git fetch; git rebase -i master should resolve to no diffs in sources/__init__.py for this branch.
> # the datasource can react to changes in metadata and regenerate
> # network configuration on metadata changes.
> # A datasource which supports writing network config on each system boot
> - # would call update_events['network'].add(EventType.BOOT).
> + # would set update_events = {'network': [EventType.BOOT]}
>
> # Default: generate network config on new instance id (first boot).
> - update_events = {'network': {EventType.BOOT_NEW_INSTANCE}}
> + update_events = {'network': [EventType.BOOT_NEW_INSTANCE]}
>
> # N-tuple listing default values for any metadata-related class
> # attributes cached on an instance by a process_data runs. These attribute
> diff --git a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_init.py
> index 762ec17..dcd221b 100644
> --- a/cloudinit/sources/tests/test_init.py
> +++ b/cloudinit/sources/tests/test_init.py
> @@ -429,9 +429,8 @@ class TestDataSource(CiTestCase):
>
> def test_update_metadata_only_acts_on_supported_update_events(self):
> """update_metadata won't get_data on unsupported update events."""
> - self.datasource.update_events['network'].discard(EventType.BOOT)
> self.assertEqual(
> - {'network': {EventType.BOOT_NEW_INSTANCE}},
> + {'network': [EventType.BOOT_NEW_INSTANCE]},
As with the changes in cloudinit/sources/__init__.py being out of step with tip of master, this delta can't use python2.7 dict comprehensions.
it instead needs to be python 2.6 compatible (as we support centos6)
{'network': set([EventType.BOOT_NEW_INSTANCE])},
> self.datasource.update_events)
>
> def fake_get_data():
--
https://code.launchpad.net/~mgerdts/cloud-init/+git/cloud-init/+merge/350375
Your team cloud-init commiters is requested to review the proposed merge of ~mgerdts/cloud-init:lp1765801 into cloud-init:master.
References