From 46cdd473cdf8994765fbd7ccbb49a75afd5b148a Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 3 Dec 2019 14:24:10 +0100 Subject: option to enable http api options --- cloudinit/config/cc_vyos.py | 9 +++++++++ cloudinit/sources/DataSourceOVF.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py index 8172a501..a1445e09 100644 --- a/cloudinit/config/cc_vyos.py +++ b/cloudinit/config/cc_vyos.py @@ -101,6 +101,8 @@ def set_config_ovf(config, hostname, metadata): DNS = list(metadata['DNS'].replace(' ', '').split(',')) NTP = list(metadata['NTP'].replace(' ', '').split(',')) APIKEY = metadata['APIKEY'] + APIPORT = metadata['APIPORT'] + APIDEBUG = metadata['APIDEBUG'] if ip_0 != '' and mask_0 != '' and gateway != '': cidr = str(IPv4Network('0.0.0.0/' + mask_0).prefixlen) @@ -130,6 +132,13 @@ def set_config_ovf(config, hostname, metadata): config.set(['service', 'https', 'api', 'keys', 'id', 'cloud-init', 'key'], value=APIKEY, replace=True) config.set_tag(['service', 'https', 'api', 'keys', 'id']) + if APIDEBUG != 'False' and APIKEY != '': + config.set(['service', 'https', 'api', 'debug'], replace=True) + + if APIPORT != '' and APIKEY != '': + config.set(['service', 'https', 'listen-address', '0.0.0.0', 'listen-port'], value=APIPORT, replace=True) + config.set_tag(['service', 'https', 'listen-address']) + 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 6330b234..2c40cf97 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', 'APIKEY'] + 'ip0', 'netmask0', 'gateway', 'DNS', 'NTP', 'APIKEY' ,'APIPORT', 'APIDEBUG'] for (prop, val) in props.items(): if prop == 'hostname': prop = "local-hostname" -- cgit v1.2.3