summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
diff options
context:
space:
mode:
authorAndrew Bogott <Andrewbogott@gmail.com>2021-02-05 10:11:14 -0600
committerGitHub <noreply@github.com>2021-02-05 11:11:14 -0500
commit3cebe0df1e002bd85c8aa78e89f0ca507c17195a (patch)
tree6211934629fd16534bd7b4d18c513192282b403a /cloudinit/sources/__init__.py
parent36ddf1ebed3f264fa86ef4f657dce29244c2e068 (diff)
downloadvyos-cloud-init-3cebe0df1e002bd85c8aa78e89f0ca507c17195a.tar.gz
vyos-cloud-init-3cebe0df1e002bd85c8aa78e89f0ca507c17195a.zip
openstack: read the dynamic metadata group vendor_data2.json (#777)
Add support for openstack's dynamic vendor data, which appears under openstack/latest/vendor_data2.json This adds vendor_data2 to all pathways; it should be a no-op for non-OpenStack providers. LP: #1841104
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r--cloudinit/sources/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 9dccc687..1ad1880d 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -187,7 +187,8 @@ class DataSource(metaclass=abc.ABCMeta):
cached_attr_defaults = (
('ec2_metadata', UNSET), ('network_json', UNSET),
('metadata', {}), ('userdata', None), ('userdata_raw', None),
- ('vendordata', None), ('vendordata_raw', None))
+ ('vendordata', None), ('vendordata_raw', None),
+ ('vendordata2', None), ('vendordata2_raw', None))
_dirty_cache = False
@@ -203,7 +204,9 @@ class DataSource(metaclass=abc.ABCMeta):
self.metadata = {}
self.userdata_raw = None
self.vendordata = None
+ self.vendordata2 = None
self.vendordata_raw = None
+ self.vendordata2_raw = None
self.ds_cfg = util.get_cfg_by_path(
self.sys_cfg, ("datasource", self.dsname), {})
@@ -392,6 +395,11 @@ class DataSource(metaclass=abc.ABCMeta):
self.vendordata = self.ud_proc.process(self.get_vendordata_raw())
return self.vendordata
+ def get_vendordata2(self):
+ if self.vendordata2 is None:
+ self.vendordata2 = self.ud_proc.process(self.get_vendordata2_raw())
+ return self.vendordata2
+
@property
def fallback_interface(self):
"""Determine the network interface used during local network config."""
@@ -494,6 +502,9 @@ class DataSource(metaclass=abc.ABCMeta):
def get_vendordata_raw(self):
return self.vendordata_raw
+ def get_vendordata2_raw(self):
+ return self.vendordata2_raw
+
# the data sources' config_obj is a cloud-config formated
# object that came to it from ways other than cloud-config
# because cloud-config content would be handled elsewhere