From 9044a05469d1b138d4ee34c55c7f5bdb6f97164d Mon Sep 17 00:00:00 2001 From: Wesley Wiedenmeier Date: Fri, 17 Feb 2017 02:16:20 -0600 Subject: Add feature flags to cloudinit.version. This exposes a mechanism for users of cloud-init to determine if a version has a specific feature, and adds documentation to that affect. We list an existing feature NETWORK_CONFIG_V1 as an example. Also add a 'features' subcommand for listing these to stdout. --- cloudinit/version.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cloudinit/version.py') diff --git a/cloudinit/version.py b/cloudinit/version.py index 92bace1a..e61597d2 100644 --- a/cloudinit/version.py +++ b/cloudinit/version.py @@ -6,6 +6,11 @@ __VERSION__ = "0.7.9" +FEATURES = [ + # supports network config version 1 + 'NETWORK_CONFIG_V1', +] + def version_string(): return __VERSION__ -- cgit v1.2.3 From de63d664a664cb06cefcd7c68c5b3428279a9995 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 21 Mar 2017 16:33:14 -0400 Subject: advertise network config v2 support (NETWORK_CONFIG_V2) in features. ef18b8ac4c added support for handing network config v2 (aka netplan format). This just adds that feature to the list of supported features. --- cloudinit/version.py | 2 ++ tests/unittests/test_version.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/unittests/test_version.py (limited to 'cloudinit/version.py') diff --git a/cloudinit/version.py b/cloudinit/version.py index e61597d2..dff4af04 100644 --- a/cloudinit/version.py +++ b/cloudinit/version.py @@ -9,6 +9,8 @@ __VERSION__ = "0.7.9" FEATURES = [ # supports network config version 1 'NETWORK_CONFIG_V1', + # supports network config version 2 (netplan) + 'NETWORK_CONFIG_V2', ] diff --git a/tests/unittests/test_version.py b/tests/unittests/test_version.py new file mode 100644 index 00000000..1662ce09 --- /dev/null +++ b/tests/unittests/test_version.py @@ -0,0 +1,14 @@ +# This file is part of cloud-init. See LICENSE file for license information. + +from .helpers import CiTestCase +from cloudinit import version + + +class TestExportsFeatures(CiTestCase): + def test_has_network_config_v1(self): + self.assertIn('NETWORK_CONFIG_V1', version.FEATURES) + + def test_has_network_config_v2(self): + self.assertIn('NETWORK_CONFIG_V2', version.FEATURES) + +# vi: ts=4 expandtab -- cgit v1.2.3