summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2019-12-03 14:24:10 +0100
committerKim Hagen <kim.sidney@gmail.com>2019-12-03 14:30:28 +0100
commite71ea889ff0b3904c1d39f2f7c9ce608f63e047a (patch)
treead4fbcb348117977bff6cc3c2c412eae332d18ce
parente8f7f71683b752956e7c3fc7113b787527217eea (diff)
downloadvyos-cloud-init-e71ea889ff0b3904c1d39f2f7c9ce608f63e047a.tar.gz
vyos-cloud-init-e71ea889ff0b3904c1d39f2f7c9ce608f63e047a.zip
option to enable http api options
-rw-r--r--cloudinit/config/cc_vyos.py9
-rw-r--r--cloudinit/sources/DataSourceOVF.py2
2 files changed, 10 insertions, 1 deletions
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"