Skip to content

Commit

Permalink
Fix incorrect destination path for --mode autoload
Browse files Browse the repository at this point in the history
In commit 3666624 the creation and saving of the files required by
openvpn3-autload was moved into the AutoloadConfig class.  But it
ignored the proper destination directory, resulting in the destination
directory becoming '/'.

Signed-off-by: David Sommerseth <[email protected]>
  • Loading branch information
dsommers committed May 30, 2022
1 parent 10c81cb commit 4cb1039
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openvpn/connector/autoload.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ class AutoloadConfig(object):
def __init__(self, profile, rootdir, cfgname_prefix):
self._profile = profile
self._rootdir = rootdir
self._config_dir = os.path.join(self._rootdir, 'etc','openvpn3','autoload')

al_cfgname = '%s.autoload' % cfgname_prefix
self._autoload_file = os.path.join(rootdir, al_cfgname)
self._autoload_file = os.path.join(self._config_dir, al_cfgname)

vpn_cfgname = '%s.conf' % cfgname_prefix
self._config_file = os.path.join(rootdir, vpn_cfgname)
self._config_file = os.path.join(self._config_dir, vpn_cfgname)

self._properties = {}

Expand Down Expand Up @@ -59,8 +60,7 @@ def SetTunnelParams(self, key, value):

def Save(self):
# Ensure proper destination directories exists
config_dir = os.path.join(self._rootdir, 'etc','openvpn3','autoload')
Path(config_dir).mkdir(parents=True, exist_ok=True)
Path(self._config_dir).mkdir(parents=True, exist_ok=True)

print('Saving VPN configuration profile to "%s" ... ' % self._config_file, end='', flush=True)
self._profile.Save(self._config_file)
Expand Down

0 comments on commit 4cb1039

Please sign in to comment.