From 0edca98b751faa3f3817fe4899d2822daade4212 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 11 Apr 2020 19:13:39 +0200 Subject: vpn: l2tp: sstp: T2264: create config dir on demand --- src/conf_mode/vpn_l2tp.py | 4 ++++ src/conf_mode/vpn_sstp.py | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py index 7cfb4e74e..7ecd8b2a4 100755 --- a/src/conf_mode/vpn_l2tp.py +++ b/src/conf_mode/vpn_l2tp.py @@ -349,6 +349,10 @@ def generate(l2tp): fs_loader = FileSystemLoader(tmpl_path) env = Environment(loader=fs_loader, trim_blocks=True) + dirname = os.path.dirname(l2tp_conf) + if not os.path.exists(dirname): + os.mkdir(dirname) + tmpl = env.get_template('l2tp.config.tmpl') config_text = tmpl.render(c) with open(l2tp_conf, 'w') as f: diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py index a0bcb1acf..b2eb5bdcb 100755 --- a/src/conf_mode/vpn_sstp.py +++ b/src/conf_mode/vpn_sstp.py @@ -305,6 +305,10 @@ def generate(sstp): fs_loader = FileSystemLoader(tmpl_path) env = Environment(loader=fs_loader, trim_blocks=True) + dirname = os.path.dirname(sstp_conf) + if not os.path.exists(dirname): + os.mkdir(dirname) + # accel-cmd reload doesn't work so any change results in a restart of the daemon tmpl = env.get_template('sstp.config.tmpl') config_text = tmpl.render(sstp) -- cgit v1.2.3