summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Hagen <kim@sentrium.io>2021-10-10 10:50:41 -0500
committerKim Hagen <kim@sentrium.io>2021-10-10 10:50:41 -0500
commitd2c17f9864d26b7adc6c9f21dbe46f1d7059dbb4 (patch)
tree1132801d6bd0f36a6c003b6fe3c00e053368f72a
parentf8dca381b4822f218b4664e89b73ea2929f90a03 (diff)
downloadvyos-1x-d2c17f9864d26b7adc6c9f21dbe46f1d7059dbb4.tar.gz
vyos-1x-d2c17f9864d26b7adc6c9f21dbe46f1d7059dbb4.zip
do not use Path
-rwxr-xr-xsrc/conf_mode/interfaces-openvpn.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py
index 7cfed0c55..2c8df4831 100755
--- a/src/conf_mode/interfaces-openvpn.py
+++ b/src/conf_mode/interfaces-openvpn.py
@@ -26,7 +26,6 @@ from ipaddress import IPv4Network
from ipaddress import IPv6Address
from ipaddress import IPv6Network
from ipaddress import summarize_address_range
-from pathlib import Path
from netifaces import interfaces
from secrets import SystemRandom
from shutil import rmtree
@@ -386,9 +385,9 @@ def verify(openvpn):
# add mfa users to the file the mfa plugin uses
if dict_search('server.mfa.totp', openvpn):
- if not Path(otp_file.format(**openvpn)).is_file():
- Path(otp_path).mkdir(parents=True, exist_ok=True)
- Path(otp_file.format(**openvpn)).touch()
+ if not os.path.isfile(otp_file.format(**openvpn)):
+ makedir(otp_path)
+ open(otp_file.format(**openvpn), 'a').close()
with tempfile.TemporaryFile(mode='w+') as fp:
with open(otp_file.format(**openvpn), 'r+') as f: