luci-proto-openvpn: create parent directory for config files
authorPaul Donald <redacted>
Wed, 4 Mar 2026 17:37:58 +0000 (18:37 +0100)
committerPaul Donald <redacted>
Wed, 4 Mar 2026 17:37:58 +0000 (18:37 +0100)
To store the configs, the parent directory shall exist first.

Signed-off-by: Paul Donald <redacted>
protocols/luci-proto-openvpn/htdocs/luci-static/resources/protocol/openvpn.js

index a24c23fbfe28fdf1d0eb737931806e4307aec1a8..956e91c3c55eaf0db3c9e127895043757a999786 100644 (file)
@@ -899,7 +899,7 @@ const openvpnOptions = [
                tab: 'management',
                type: form.Value,
                name: 'management_external_cert',
-               datatype: 'path',
+               datatype: 'file',
                label: _('Management cert'),
                placeholder: 'certificate-hint'
        },
@@ -907,7 +907,7 @@ const openvpnOptions = [
                tab: 'management',
                type: form.Value,
                name: 'management_external_key',
-               datatype: 'path',
+               datatype: 'file',
                label: _('Management key'),
                placeholder: 'nopadding pkcs1'
        },
@@ -1867,9 +1867,11 @@ return network.registerProtocol('openvpn', {
                };
                ovconf.write = function(sid, value) {
                        const config_name = `/etc/openvpn/${sid}/${sid}_config.cfg`;
+                       fs.exec_direct('/bin/mkdir', ['-p', `/etc/openvpn/${sid}/`]).then(result => {
+                               fs.write(config_name, value).catch(() => {});
+                               uci.set(this.config, sid, 'config', config_name);
+                       });
 
-                       fs.write(config_name, value).catch(() => {});
-                       uci.set(this.config, sid, 'config', config_name);
                        return 
                };
                ovconf.rmempty = true;
git clone https://git.99rst.org/PROJECT