From d2c17f9864d26b7adc6c9f21dbe46f1d7059dbb4 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Sun, 10 Oct 2021 10:50:41 -0500 Subject: do not use Path --- src/conf_mode/interfaces-openvpn.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/conf_mode/interfaces-openvpn.py') 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: -- cgit v1.2.3