cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #01669
[Merge] ~smoser/cloud-init:feature/feature-flags into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:feature/feature-flags into cloud-init:master.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/319605
--
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:feature/feature-flags into cloud-init:master.
diff --git a/cloudinit/version.py b/cloudinit/version.py
index 92bace1..e61597d 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__
diff --git a/doc/rtd/topics/capabilities.rst b/doc/rtd/topics/capabilities.rst
index be0802c..4a41108 100644
--- a/doc/rtd/topics/capabilities.rst
+++ b/doc/rtd/topics/capabilities.rst
@@ -7,6 +7,7 @@ Capabilities
- Generating instance ssh private keys
- Adding ssh keys to a users ``.ssh/authorized_keys`` so they can log in
- Setting up ephemeral mount points
+- Configuring network devices
User configurability
====================
@@ -22,5 +23,27 @@ ec2-run-instances for example.
string or `user-data` file for usage by cloud-init on instance creation.
+Feature detection
+=================
+
+Newer versions of cloud-init may have a list of additional features that they
+support. This allows other applications to detect what features the installed
+cloud-init supports without having to parse its version number. If present,
+this list of features will be located at ``cloudinit.version.FEATURES``.
+
+When checking if cloud-init supports a feature, in order to not break the
+detection script on older versions of cloud-init without the features list, a
+script similar to the following should be used. Note that this will exit 0 if
+the feature is supported and 1 otherwise::
+
+ import sys
+ from cloudinit import version
+ sys.exit('<FEATURE_NAME>' not in getattr(version, 'FEATURES', []))
+
+Currently defined feature names include:
+
+ - ``NETWORK_CONFIG_V1`` support for v1 networking configuration, see curtin
+ documentation for examples.
+
.. _Cloud-init: https://launchpad.net/cloud-init
.. vi: textwidth=78
Follow ups