summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-wireless.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-09 09:45:40 +0200
committerGitHub <noreply@github.com>2023-08-09 09:45:40 +0200
commit98ed11a7d6e35de49f57406a0dd9d4759541f2d4 (patch)
tree3eb831987a33c1d86acd6668c034ee25188d21ef /src/conf_mode/interfaces-wireless.py
parent0e92ee262d8ec6ee88d7331f2cbffe8b6b689437 (diff)
parent4c5afc9bd6d5acd6089d2b78c03daa65529eaec9 (diff)
downloadvyos-1x-98ed11a7d6e35de49f57406a0dd9d4759541f2d4.tar.gz
vyos-1x-98ed11a7d6e35de49f57406a0dd9d4759541f2d4.zip
Merge pull request #2136 from jestabro/with-defaults
T5319: remove workarounds for incorrect defaults in config-mode scripts
Diffstat (limited to 'src/conf_mode/interfaces-wireless.py')
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 42326bea0..e49ad25ac 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -79,27 +79,9 @@ def get_config(config=None):
ifname, wifi = get_interface_dict(conf, base)
- # Cleanup "delete" default values when required user selectable values are
- # not defined at all
- tmp = conf.get_config_dict(base + [ifname], key_mangling=('-', '_'),
- get_first_key=True)
- if not (dict_search('security.wpa.passphrase', tmp) or
- dict_search('security.wpa.radius', tmp)):
- if 'deleted' not in wifi:
- del wifi['security']['wpa']
- # if 'security' key is empty, drop it too
- if len(wifi['security']) == 0:
- del wifi['security']
-
- # defaults include RADIUS server specifics per TAG node which need to be
- # added to individual RADIUS servers instead - so we can simply delete them
- if dict_search('security.wpa.radius.server.port', wifi) != None:
- del wifi['security']['wpa']['radius']['server']['port']
- if not len(wifi['security']['wpa']['radius']['server']):
- del wifi['security']['wpa']['radius']
- if not len(wifi['security']['wpa']):
- del wifi['security']['wpa']
- if not len(wifi['security']):
+ if 'deleted' not in wifi:
+ # then get_interface_dict provides default keys
+ if wifi.from_defaults(['security']): # if not set by user
del wifi['security']
if 'security' in wifi and 'wpa' in wifi['security']:
@@ -120,14 +102,6 @@ def get_config(config=None):
tmp = find_other_stations(conf, base, wifi['ifname'])
if tmp: wifi['station_interfaces'] = tmp
- # Add individual RADIUS server default values
- if dict_search('security.wpa.radius.server', wifi):
- default_values = defaults(base + ['security', 'wpa', 'radius', 'server'])
-
- for server in dict_search('security.wpa.radius.server', wifi):
- wifi['security']['wpa']['radius']['server'][server] = dict_merge(
- default_values, wifi['security']['wpa']['radius']['server'][server])
-
return wifi
def verify(wifi):