diff options
| author | Ben Howard <ben.howard@canonical.com> | 2014-02-07 10:10:02 +0200 |
|---|---|---|
| committer | Ben Howard <ben.howard@canonical.com> | 2014-02-07 10:10:02 +0200 |
| commit | 3087da32ec5cf84c51e0ebdd80a71a84b174a392 (patch) | |
| tree | 1918a08395e97dbd84bbf43c65c5740bf4ee3365 /cloudinit/sources/__init__.py | |
| parent | 4fe439b9e137e0b59d00e919dc16aea9da35082a (diff) | |
| parent | 3cfe9b3d8958b1a4e450d5ff31d805c424945027 (diff) | |
| download | vyos-cloud-init-3087da32ec5cf84c51e0ebdd80a71a84b174a392.tar.gz vyos-cloud-init-3087da32ec5cf84c51e0ebdd80a71a84b174a392.zip | |
Rebase on upstream
Diffstat (limited to 'cloudinit/sources/__init__.py')
| -rw-r--r-- | cloudinit/sources/__init__.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py index 7dc1fbde..fef4d460 100644 --- a/cloudinit/sources/__init__.py +++ b/cloudinit/sources/__init__.py @@ -53,6 +53,8 @@ class DataSource(object): self.userdata = None self.metadata = None self.userdata_raw = None + self.vendordata = None + self.vendordata_raw = None # find the datasource config name. # remove 'DataSource' from classname on front, and remove 'Net' on end. @@ -77,9 +79,14 @@ class DataSource(object): if self.userdata is None: self.userdata = self.ud_proc.process(self.get_userdata_raw()) if apply_filter: - return self._filter_userdata(self.userdata) + return self._filter_xdata(self.userdata) return self.userdata + def get_vendordata(self): + if self.vendordata is None: + self.vendordata = self.ud_proc.process(self.get_vendordata_raw()) + return self.vendordata + @property def launch_index(self): if not self.metadata: @@ -88,7 +95,7 @@ class DataSource(object): return self.metadata['launch-index'] return None - def _filter_userdata(self, processed_ud): + def _filter_xdata(self, processed_ud): filters = [ launch_index.Filter(util.safe_int(self.launch_index)), ] @@ -104,6 +111,9 @@ class DataSource(object): def get_userdata_raw(self): return self.userdata_raw + def get_vendordata_raw(self): + return self.vendordata_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 @@ -119,7 +129,7 @@ class DataSource(object): # when the kernel named them 'vda' or 'xvda' # we want to return the correct value for what will actually # exist in this instance - mappings = {"sd": ("vd", "xvd")} + mappings = {"sd": ("vd", "xvd", "vtb")} for (nfrom, tlist) in mappings.iteritems(): if not short_name.startswith(nfrom): continue |
