diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-05-21 18:21:07 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-05-21 18:21:07 +0200 |
commit | 2c9bbd821d6cb6f9ea66435e5a2161e85c1b9350 (patch) | |
tree | 26ab10f153d02846de04cfc75bf7f82f9f3ba05f /src/conf_mode | |
parent | e12390d75b5ea0423f19efc1dc5dd97ae5fe42dd (diff) | |
download | vyos-1x-2c9bbd821d6cb6f9ea66435e5a2161e85c1b9350.tar.gz vyos-1x-2c9bbd821d6cb6f9ea66435e5a2161e85c1b9350.zip |
wireless: T1627: remove get_conf_file()
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index f13408fa2..0fa20c5f4 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -95,16 +95,9 @@ default_config_data = { 'vif_s_remove': [] } -def get_conf_file(conf_type, intf): - cfg_dir = '/run/' + conf_type - - # create directory on demand - if not os.path.exists(cfg_dir): - os.makedirs(cfg_dir, 0o755) - chown(cfg_dir, 'root', 'vyattacfg') - - cfg_file = cfg_dir + r'/{}.conf'.format(intf) - return cfg_file +# XXX: wpa_supplicant works on the source interface +wpa_suppl_conf = '/run/wpa_supplicant/{intf}.conf' +hostapd_conf = '/run/hostapd/{intf}.conf' def get_config(): # determine tagNode instance @@ -518,11 +511,11 @@ def generate(wifi): # Delete config files if interface is removed if wifi['deleted']: - if os.path.isfile(get_conf_file('hostapd', interface)): - os.unlink(get_conf_file('hostapd', interface)) + if os.path.isfile(hostapd_conf.format(**wifi)): + os.unlink(hostapd_conf.format(**wifi)) - if os.path.isfile(get_conf_file('wpa_supplicant', interface)): - os.unlink(get_conf_file('wpa_supplicant', interface)) + if os.path.isfile(wpa_suppl_conf.format(**wifi)): + os.unlink(wpa_suppl_conf.format(**wifi)) return None @@ -550,12 +543,10 @@ def generate(wifi): # render appropriate new config files depending on access-point or station mode if wifi['op_mode'] == 'ap': - conf = get_conf_file('hostapd', interface) - render(conf, 'wifi/hostapd.conf.tmpl', wifi) + render(hostapd_conf.format(**wifi), 'wifi/hostapd.conf.tmpl', wifi) elif wifi['op_mode'] == 'station': - conf = get_conf_file('wpa_supplicant', interface) - render(conf, 'wifi/wpa_supplicant.conf.tmpl', wifi) + render(wpa_suppl_conf.format(**wifi), 'wifi/wpa_supplicant.conf.tmpl', wifi) return None |