summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-31 19:57:06 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-31 19:59:25 +0200
commit9c63731d6683f59ea784c08852ed38e3ac22794b (patch)
treecebb83f73174ca647fdb59bccb3a584d3b3670e5
parent621fcb078abb53888e995a007fb9ea31e95e34ab (diff)
downloadvyos-1x-9c63731d6683f59ea784c08852ed38e3ac22794b.tar.gz
vyos-1x-9c63731d6683f59ea784c08852ed38e3ac22794b.zip
T2636: remove workarounds for get_config_dict()
Now that b40c52682a256 ("config: T2636: get_config_dict() returns a list on multi node by default") is implemented the workarounds can be removed.
-rw-r--r--data/templates/ntp/ntp.conf.tmpl16
-rw-r--r--data/templates/ssh/sshd_config.tmpl16
-rw-r--r--data/templates/wifi/hostapd.conf.tmpl12
-rw-r--r--python/vyos/configdict.py3
-rw-r--r--python/vyos/ifconfig/interface.py7
-rw-r--r--python/vyos/ifconfig/loopback.py5
-rwxr-xr-xsrc/conf_mode/https.py9
7 files changed, 8 insertions, 60 deletions
diff --git a/data/templates/ntp/ntp.conf.tmpl b/data/templates/ntp/ntp.conf.tmpl
index 6ef0c0f2c..df8157a41 100644
--- a/data/templates/ntp/ntp.conf.tmpl
+++ b/data/templates/ntp/ntp.conf.tmpl
@@ -25,23 +25,15 @@ server {{ srv | replace('_', '-') }} iburst {{ options }}
{% if allow_clients is defined and allow_clients.address is defined %}
# Allowed clients configuration
-{% if allow_clients.address is string %}
-restrict {{ allow_clients.address|address_from_cidr }} mask {{ allow_clients.address|netmask_from_cidr }} nomodify notrap nopeer
-{% else %}
-{% for address in allow_clients.address %}
+{% for address in allow_clients.address %}
restrict {{ address|address_from_cidr }} mask {{ address|netmask_from_cidr }} nomodify notrap nopeer
-{% endfor %}
-{% endif %}
+{% endfor %}
{% endif %}
{% if listen_address %}
# NTP should listen on configured addresses only
interface ignore wildcard
-{% if listen_address is string %}
-interface listen {{ listen_address }}
-{% else %}
-{% for address in listen_address %}
+{% for address in listen_address %}
interface listen {{ address }}
-{% endfor %}
-{% endif %}
+{% endfor %}
{% endif %}
diff --git a/data/templates/ssh/sshd_config.tmpl b/data/templates/ssh/sshd_config.tmpl
index 4fde24255..52d537aca 100644
--- a/data/templates/ssh/sshd_config.tmpl
+++ b/data/templates/ssh/sshd_config.tmpl
@@ -37,13 +37,9 @@ PermitRootLogin no
UseDNS {{ "no" if disable_host_validation is defined else "yes" }}
# Specifies the port number that sshd(8) listens on
-{% if port is string %}
-Port {{ port }}
-{% else %}
-{% for value in port %}
+{% for value in port %}
Port {{ value }}
-{% endfor %}
-{% endif %}
+{% endfor %}
# Gives the verbosity level that is used when logging messages from sshd
LogLevel {{ loglevel | upper }}
@@ -53,13 +49,9 @@ PasswordAuthentication {{ "no" if disable_password_authentication is defined els
{% if listen_address %}
# Specifies the local addresses sshd should listen on
-{% if listen_address is string %}
-ListenAddress {{ listen_address }}
-{% else %}
-{% for address in listen_address %}
+{% for address in listen_address %}
ListenAddress {{ address }}
-{% endfor %}
-{% endif %}
+{% endfor %}
{% endif %}
{% if ciphers %}
diff --git a/data/templates/wifi/hostapd.conf.tmpl b/data/templates/wifi/hostapd.conf.tmpl
index 765668c57..a7efee6d5 100644
--- a/data/templates/wifi/hostapd.conf.tmpl
+++ b/data/templates/wifi/hostapd.conf.tmpl
@@ -500,18 +500,10 @@ wpa=1
{% if security.wpa.mode is defined and security.wpa.mode == 'wpa2' %}
# Pairwise cipher for RSN/WPA2 (default: use wpa_pairwise value)
-{% if security.wpa.cipher is string %}
-rsn_pairwise={{ security.wpa.cipher }}
-{% else %}
rsn_pairwise={{ security.wpa.cipher | join(" ") }}
-{% endif %}
{% else %}
# Pairwise cipher for WPA (v1) (default: TKIP)
-{% if security.wpa.cipher is string %}
-wpa_pairwise={{ security.wpa.cipher }}
-{% else %}
wpa_pairwise={{ security.wpa.cipher | join(" ") }}
-{% endif %}
{% endif %}
{% endif %}
@@ -522,11 +514,7 @@ wpa_pairwise={{ security.wpa.cipher | join(" ") }}
# overriding the group cipher with an unexpected value can result in
# interoperability issues and in general, this parameter is mainly used for
# testing purposes.
-{% if security.wpa.group_cipher is string %}
-group_cipher={{ security.wpa.group_cipher }}
-{% else %}
group_cipher={{ security.wpa.group_cipher | join(" ") }}
-{% endif %}
{% endif %}
{% if security.wpa.passphrase is defined %}
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index bd8624ced..e8c0aa5b3 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -270,9 +270,6 @@ def get_interface_dict(config, base, ifname=''):
eui64 = leaf_node_changed(config, ['ipv6', 'address', 'eui64'])
if eui64:
- # XXX: T2636 workaround: convert string to a list with one element
- if isinstance(eui64, str):
- eui64 = [eui64]
tmp = vyos_dict_search('ipv6.address', dict)
if not tmp:
dict.update({'ipv6': {'address': {'eui64_old': eui64}}})
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 67ba973c4..ef2336c17 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -898,10 +898,6 @@ class Interface(Control):
# configured addresses will be removed first
new_addr = config.get('address', [])
- # XXX: T2636 workaround: convert string to a list with one element
- if isinstance(new_addr, str):
- new_addr = [new_addr]
-
# always ensure DHCP client is stopped (when not configured explicitly)
if 'dhcp' not in new_addr:
self.del_addr('dhcp')
@@ -1023,9 +1019,6 @@ class Interface(Control):
# Add IPv6 EUI-based addresses
tmp = vyos_dict_search('ipv6.address.eui64', config)
if tmp:
- # XXX: T2636 workaround: convert string to a list with one element
- if isinstance(tmp, str):
- tmp = [tmp]
for addr in tmp:
self.add_ipv6_eui64_address(addr)
diff --git a/python/vyos/ifconfig/loopback.py b/python/vyos/ifconfig/loopback.py
index 2b4ebfdcc..c70e1773f 100644
--- a/python/vyos/ifconfig/loopback.py
+++ b/python/vyos/ifconfig/loopback.py
@@ -64,11 +64,6 @@ class LoopbackIf(Interface):
on any interface. """
addr = config.get('address', [])
- # XXX workaround for T2636, convert IP address string to a list
- # with one element
- if isinstance(addr, str):
- addr = [addr]
-
# We must ensure that the loopback addresses are never deleted from the system
addr += self._persistent_addresses
diff --git a/src/conf_mode/https.py b/src/conf_mode/https.py
index dc51cb117..de228f0f8 100755
--- a/src/conf_mode/https.py
+++ b/src/conf_mode/https.py
@@ -74,9 +74,6 @@ def get_config(config=None):
server_block['address'] = data.get('listen-address', '*')
server_block['port'] = data.get('listen-port', '443')
name = data.get('server-name', ['_'])
- # XXX: T2636 workaround: convert string to a list with one element
- if not isinstance(name, list):
- name = [name]
server_block['name'] = name
server_block_list.append(server_block)
@@ -98,9 +95,6 @@ def get_config(config=None):
certbot = False
cert_domains = cert_dict.get('certbot', {}).get('domain-name', [])
if cert_domains:
- # XXX: T2636 workaround: convert string to a list with one element
- if not isinstance(cert_domains, list):
- cert_domains = [cert_domains]
certbot = True
for domain in cert_domains:
sub_list = vyos.certbot_util.choose_server_block(server_block_list,
@@ -125,9 +119,6 @@ def get_config(config=None):
if port:
api_data['port'] = port
vhosts = https_dict.get('api-restrict', {}).get('virtual-host', [])
- # XXX: T2636 workaround: convert string to a list with one element
- if not isinstance(vhosts, list):
- vhosts = [vhosts]
if vhosts:
api_data['vhost'] = vhosts[:]