diff options
author | Kim Hagen <kim.sidney@gmail.com> | 2019-11-12 15:43:05 +0100 |
---|---|---|
committer | Kim Hagen <kim.sidney@gmail.com> | 2019-11-12 15:43:05 +0100 |
commit | e8f7f71683b752956e7c3fc7113b787527217eea (patch) | |
tree | c53fcbcadb6dcc74209fd45e32acd86861b01db3 | |
parent | 1bc013d9336e25fb4170fa3e4883b62793090381 (diff) | |
download | vyos-cloud-init-e8f7f71683b752956e7c3fc7113b787527217eea.tar.gz vyos-cloud-init-e8f7f71683b752956e7c3fc7113b787527217eea.zip |
add the ability to put the api key
-rw-r--r-- | cloudinit/config/cc_vyos.py | 5 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceOVF.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py index af588035..8172a501 100644 --- a/cloudinit/config/cc_vyos.py +++ b/cloudinit/config/cc_vyos.py @@ -100,6 +100,7 @@ def set_config_ovf(config, hostname, metadata): gateway = metadata['gateway'] DNS = list(metadata['DNS'].replace(' ', '').split(',')) NTP = list(metadata['NTP'].replace(' ', '').split(',')) + APIKEY = metadata['APIKEY'] if ip_0 != '' and mask_0 != '' and gateway != '': cidr = str(IPv4Network('0.0.0.0/' + mask_0).prefixlen) @@ -125,6 +126,10 @@ def set_config_ovf(config, hostname, metadata): config.set(['system', 'ntp', 'server'], value=server, replace=False) config.set_tag(['system', 'ntp', 'server']) + if APIKEY != '': + config.set(['service', 'https', 'api', 'keys', 'id', 'cloud-init', 'key'], value=APIKEY, replace=True) + config.set_tag(['service', 'https', 'api', 'keys', 'id']) + config.set(['service', 'ssh'], replace=True) config.set(['service', 'ssh', 'port'], value='22', replace=True) diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py index 0edf76aa..6330b234 100644 --- a/cloudinit/sources/DataSourceOVF.py +++ b/cloudinit/sources/DataSourceOVF.py @@ -396,7 +396,7 @@ def read_ovf_environment(contents): ud = None cfg_props = ['password'] md_props = ['seedfrom', 'local-hostname', 'public-keys', 'instance-id', - 'ip0', 'netmask0', 'gateway', 'DNS', 'NTP'] + 'ip0', 'netmask0', 'gateway', 'DNS', 'NTP', 'APIKEY'] for (prop, val) in props.items(): if prop == 'hostname': prop = "local-hostname" |