diff options
author | Chad Smith <chad.smith@canonical.com> | 2017-12-05 16:42:35 -0700 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-12-05 16:42:35 -0700 |
commit | 0cf6db3617e0cebeb89c4809396f84360827e96c (patch) | |
tree | 834a950c7b2155c328b11ca4be3736d07fe039ea /cloudinit/sources/DataSourceAzure.py | |
parent | 30b4d15764a1a9644379cf95770e8b2480856882 (diff) | |
download | vyos-cloud-init-0cf6db3617e0cebeb89c4809396f84360827e96c.tar.gz vyos-cloud-init-0cf6db3617e0cebeb89c4809396f84360827e96c.zip |
Datasources: Formalize DataSource get_data and related properties.
Each DataSource subclass must define its own get_data method. This branch
formalizes our DataSource class to require that subclasses define an
explicit dsname for sourcing cloud-config datasource configuration.
Subclasses must also override the _get_data method or a
NotImplementedError is raised.
The branch also writes /run/cloud-init/instance-data.json. This file
contains all meta-data, user-data and vendor-data and a standardized set
of metadata keys in a json blob which other utilities with root-access
could make use of. Because some meta-data or user-data is potentially
sensitive the file is only readable by root.
Generally most metadata content types should be json serializable. If
specific keys or values are not serializable, those specific values will
be base64encoded and the key path will be listed under the top-level key
'base64-encoded-keys' in instance-data.json. If json writing fails due to
other TypeErrors or UnicodeDecodeErrors, a warning log will be emitted to
/var/log/cloud-init.log and no instance-data.json will be created.
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 14367e9c..6978d4e5 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -246,6 +246,8 @@ def temporary_hostname(temp_hostname, cfg, hostname_command='hostname'): class DataSourceAzure(sources.DataSource): + + dsname = 'Azure' _negotiated = False def __init__(self, sys_cfg, distro, paths): @@ -330,7 +332,7 @@ class DataSourceAzure(sources.DataSource): metadata['public-keys'] = key_value or pubkeys_from_crt_files(fp_files) return metadata - def get_data(self): + def _get_data(self): # azure removes/ejects the cdrom containing the ovf-env.xml # file on reboot. So, in order to successfully reboot we # need to look in the datadir and consider that valid |