Tinc: upgrade scripts to python 3, closes https://github.com/opnsense/plugins/issues/1371

This commit is contained in:
Ad Schellevis
2019-06-19 10:10:20 +02:00
parent 9674bb26da
commit 4604fc89ff
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
PLUGIN_NAME= tinc
PLUGIN_VERSION= 1.4
PLUGIN_REVISION= 2
PLUGIN_REVISION= 3
PLUGIN_COMMENT= Tinc VPN
PLUGIN_DEPENDS= tinc
PLUGIN_MAINTAINER= ad@opnsense.org
@@ -1,7 +1,7 @@
#!/usr/local/bin/python2.7
#!/usr/local/bin/python3
"""
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
Copyright (c) 2016-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1,7 +1,7 @@
#!/usr/local/bin/python2.7
#!/usr/local/bin/python3
"""
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
Copyright (c) 2016-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@ response = dict()
p = Popen(['/usr/bin/openssl','enc', '-help'],stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1)
output, error = p.communicate()
cipher_section = False
for line in error.split('\n'):
for line in error.decode().split('\n'):
if line.find('Cipher Types') == 0:
cipher_section = True
continue
@@ -1,7 +1,7 @@
#!/usr/local/bin/python2.7
#!/usr/local/bin/python3
"""
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
Copyright (c) 2016-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,7 @@ def read_config(config_filename):
return result
def deploy(config_filename):
interfaces = (subprocess.check_output(['/sbin/ifconfig','-l'])).split()
interfaces = (subprocess.check_output(['/sbin/ifconfig','-l'])).decode().split()
networks = read_config(config_filename)
# remove previous configuration
os.system('rm -rf /usr/local/etc/tinc')
@@ -89,7 +89,7 @@ def deploy(config_filename):
# configure and rename new tun device, place all in group "tinc" symlink associated tun device
if interface_name not in interfaces:
tundev = subprocess.check_output(['/sbin/ifconfig',interface_type,'create']).split()[0]
tundev = subprocess.check_output(['/sbin/ifconfig',interface_type,'create']).decode().split()[0]
subprocess.call(['/sbin/ifconfig',tundev,'name',interface_name])
subprocess.call(['/sbin/ifconfig',interface_name,'group','tinc'])
if os.path.islink('/dev/%s' % interface_name):