summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-10 18:33:42 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-11 11:25:13 +0200
commit87151df4aabc6d131d341837327dac29afd492ed (patch)
tree1e69917dcbd8cd8125ba44a1858f01ea0a64ce77
parentf35cf88ec4c63ba8510bbccbbb60bacc16d02aa5 (diff)
downloadvyos-1x-87151df4aabc6d131d341837327dac29afd492ed.tar.gz
vyos-1x-87151df4aabc6d131d341837327dac29afd492ed.zip
vpn: l2tp: T2264: import cleanup
-rwxr-xr-xsrc/conf_mode/vpn_l2tp.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py
index 4ca5a858a..5a68faa5d 100755
--- a/src/conf_mode/vpn_l2tp.py
+++ b/src/conf_mode/vpn_l2tp.py
@@ -14,12 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import sys
import os
import re
-import jinja2
-import socket
-import time
+
+from socket import AF_INET, SOCK_STREAM, socket
+from sys import exit
+from time import sleep
from jinja2 import FileSystemLoader, Environment
@@ -50,13 +50,13 @@ if not os.path.exists(l2tp_cnf_dir):
def chk_con():
cnt = 0
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s = socket(AF_INET, SOCK_STREAM)
while True:
try:
s.connect(("127.0.0.1", 2004))
break
except ConnectionRefusedError:
- time.sleep(0.5)
+ sleep(0.5)
cnt += 1
if cnt == 100:
raise("failed to start l2tp server")
@@ -66,7 +66,7 @@ def chk_con():
def _accel_cmd(command):
return run(f'/usr/bin/accel-cmd -p 2004 {command}')
-###
+###
# inline helper functions end
###
@@ -394,4 +394,4 @@ if __name__ == '__main__':
apply(c)
except ConfigError as e:
print(e)
- sys.exit(1)
+ exit(1)