Merge ~wesley-wiedenmeier/cloud-init:feature-flags into ~raharper/cloud-init:netconfig-v2-passthrough

Proposed by Wesley Wiedenmeier on 2017-02-17
Status: Rejected
Rejected by: Ryan Harper on 2017-08-31
Proposed branch: ~wesley-wiedenmeier/cloud-init:feature-flags
Merge into: ~raharper/cloud-init:netconfig-v2-passthrough
Diff against target: 56 lines (+28/-0)
2 files modified
cloudinit/version.py (+5/-0)
doc/rtd/topics/capabilities.rst (+23/-0)
Reviewer Review Type Date Requested Status
Ryan Harper 2017-02-17 Pending
Review via email: mp+317589@code.launchpad.net

Description of the Change

Add feature flag for netconfig-v2

To post a comment you must log in.
e38617d... by Wesley Wiedenmeier on 2017-02-17

Change feature flag for v2 networking to 'NETWORK_CONFIG_V2' to match curtin

note that the diff displayed below is incorrect, launchpad isn't updating it for some reason

actual diff:

-[laptop1]- -[~/code/cloud-init]-
-[02:07 PM]-git rev-parse HEAD
e38617d52090b3b01278f6840d46154e83fc31da
-[laptop1]- -[~/code/cloud-init]-
-[02:07 PM]-git diff net_devel/netconfig-v2-passthrough
diff --git a/cloudinit/version.py b/cloudinit/version.py
index 92bace1..dd77f7c 100644
--- a/cloudinit/version.py
+++ b/cloudinit/version.py
@@ -6,6 +6,11 @@

 __VERSION__ = "0.7.9"

+FEATURES = [
+ # supports network config version 2
+ 'NETWORK_CONFIG_V2',
+]
+

 def version_string():
     return __VERSION__

3d496d0... by Wesley Wiedenmeier on 2017-03-03

Added documentation on cloud-init feature flags to capabilities doc

Chad Smith (chad.smith) wrote :

A features subcommand is now implemented in cloud-init, and includes this content and allows a user to run "cloud-init features" on the commandline.

Ryan Harper (raharper) wrote :

Launchpad language is harsh, it's not really rejected; but marking it so cleans up our list of active reviews.

Unmerged commits

3d496d0... by Wesley Wiedenmeier on 2017-03-03

Added documentation on cloud-init feature flags to capabilities doc

e38617d... by Wesley Wiedenmeier on 2017-02-17

Change feature flag for v2 networking to 'NETWORK_CONFIG_V2' to match curtin

0199004... by Wesley Wiedenmeier on 2017-02-17

Add feature flags to cloudinit.version and 'netconfig-v2' flag

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/version.py b/cloudinit/version.py
2index 92bace1..dd77f7c 100644
3--- a/cloudinit/version.py
4+++ b/cloudinit/version.py
5@@ -6,6 +6,11 @@
6
7 __VERSION__ = "0.7.9"
8
9+FEATURES = [
10+ # supports network config version 2
11+ 'NETWORK_CONFIG_V2',
12+]
13+
14
15 def version_string():
16 return __VERSION__
17diff --git a/doc/rtd/topics/capabilities.rst b/doc/rtd/topics/capabilities.rst
18index be0802c..9ce11ec 100644
19--- a/doc/rtd/topics/capabilities.rst
20+++ b/doc/rtd/topics/capabilities.rst
21@@ -7,6 +7,7 @@ Capabilities
22 - Generating instance ssh private keys
23 - Adding ssh keys to a users ``.ssh/authorized_keys`` so they can log in
24 - Setting up ephemeral mount points
25+- Configuring network devices
26
27 User configurability
28 ====================
29@@ -22,5 +23,27 @@ ec2-run-instances for example.
30 string or `user-data` file for usage by cloud-init on instance creation.
31
32
33+Feature detection
34+=================
35+
36+Newer versions of cloud-init may have a list of additional features that they
37+support. This allows other applications to detect what features the installed
38+cloud-init supports without having to parse its version number. If present,
39+this list of features will be located at ``cloudinit.version.FEATURES``.
40+
41+When checking if cloud-init supports a feature, in order to not break the
42+detection script on older versions of cloud-init without the features list, a
43+script similar to the following should be used. Note that this will exit 0 if
44+the feature is supported and 1 otherwise::
45+
46+ import sys
47+ from cloudinit import version
48+ sys.exit('<FEATURE_NAME>' not in getattr(version, 'FEATURES', []))
49+
50+Currently defined feature names include:
51+
52+ - ``NETWORK_CONFIG_V2`` support for v2 networking configuration, see netplan
53+ docs for examples.
54+
55 .. _Cloud-init: https://launchpad.net/cloud-init
56 .. vi: textwidth=78

Subscribers

People subscribed via source and target branches