cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05537
[Merge] ~chad.smith/cloud-init:cleanup/surface-experimental-doc-instance-data.json into cloud-init:master
Chad Smith has proposed merging ~chad.smith/cloud-init:cleanup/surface-experimental-doc-instance-data.json into cloud-init:master.
Commit message:
docs: surface experimental doc in instance-data.json
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/355731
--
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:cleanup/surface-experimental-doc-instance-data.json into cloud-init:master.
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 730e817..7b50955 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -38,6 +38,11 @@ DEP_FILESYSTEM = "FILESYSTEM"
DEP_NETWORK = "NETWORK"
DS_PREFIX = 'DataSource'
+EXPERIMENTAL_TEXT = (
+ "EXPERIMENTAL: The structure and format of content scoped under the 'ds'"
+ "key may change in subsequent releases of cloud-init.")
+
+
# File in which public available instance meta-data is written
# security-sensitive key values are redacted from this world-readable file
INSTANCE_JSON_FILE = 'instance-data.json'
@@ -243,8 +248,8 @@ class DataSource(object):
@return True on successful write, False otherwise.
"""
instance_data = {
- 'ds': {
- 'meta_data': self.metadata}}
+ 'ds': {'_doc': EXPERIMENTAL_TEXT,
+ 'meta_data': self.metadata}}
if hasattr(self, 'network_json'):
network_json = getattr(self, 'network_json')
if network_json != UNSET:
diff --git a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_init.py
index 6b96575..8082019 100644
--- a/cloudinit/sources/tests/test_init.py
+++ b/cloudinit/sources/tests/test_init.py
@@ -10,8 +10,8 @@ from cloudinit.event import EventType
from cloudinit.helpers import Paths
from cloudinit import importer
from cloudinit.sources import (
- INSTANCE_JSON_FILE, INSTANCE_JSON_SENSITIVE_FILE, REDACT_SENSITIVE_VALUE,
- UNSET, DataSource, redact_sensitive_keys)
+ EXPERIMENTAL_TEXT, INSTANCE_JSON_FILE, INSTANCE_JSON_SENSITIVE_FILE,
+ REDACT_SENSITIVE_VALUE, UNSET, DataSource, redact_sensitive_keys)
from cloudinit.tests.helpers import CiTestCase, skipIf, mock
from cloudinit.user_data import UserDataProcessor
from cloudinit import util
@@ -305,6 +305,7 @@ class TestDataSource(CiTestCase):
'local_hostname': 'test-subclass-hostname',
'region': 'myregion'},
'ds': {
+ '_doc': EXPERIMENTAL_TEXT,
'meta_data': {'availability_zone': 'myaz',
'local-hostname': 'test-subclass-hostname',
'region': 'myregion'}}}
@@ -348,6 +349,7 @@ class TestDataSource(CiTestCase):
'local_hostname': 'test-subclass-hostname',
'region': 'myregion'},
'ds': {
+ '_doc': EXPERIMENTAL_TEXT,
'meta_data': {
'availability_zone': 'myaz',
'local-hostname': 'test-subclass-hostname',