openvpn: yapf indentation

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2018-01-12 17:37:11 +05:30 committed by James Valleroy
parent 71cc0e1fb0
commit 1779ac8928
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 22 additions and 23 deletions

View File

@ -16,7 +16,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
""" """
Configuration helper for OpenVPN server. Configuration helper for OpenVPN server.
""" """
@ -92,8 +91,7 @@ CERTIFICATE_CONFIGURATION = {
'KEY_NAME': 'FreedomBox' 'KEY_NAME': 'FreedomBox'
} }
COMMON_ARGS = {'env': CERTIFICATE_CONFIGURATION, COMMON_ARGS = {'env': CERTIFICATE_CONFIGURATION, 'cwd': KEYS_DIRECTORY}
'cwd': KEYS_DIRECTORY}
def parse_arguments(): def parse_arguments():
@ -155,10 +153,12 @@ def _create_server_config():
def _setup_firewall(): def _setup_firewall():
"""Add TUN device to internal zone in firewalld.""" """Add TUN device to internal zone in firewalld."""
subprocess.call(['firewall-cmd', '--zone', 'internal', subprocess.call(
'--add-interface', 'tun+']) ['firewall-cmd', '--zone', 'internal', '--add-interface', 'tun+'])
subprocess.call(['firewall-cmd', '--permanent', '--zone', 'internal', subprocess.call([
'--add-interface', 'tun+']) 'firewall-cmd', '--permanent', '--zone', 'internal', '--add-interface',
'tun+'
])
def _create_certificates(): def _create_certificates():
@ -171,8 +171,8 @@ def _create_certificates():
subprocess.check_call(['/usr/share/easy-rsa/clean-all'], **COMMON_ARGS) subprocess.check_call(['/usr/share/easy-rsa/clean-all'], **COMMON_ARGS)
subprocess.check_call(['/usr/share/easy-rsa/pkitool', '--initca'], subprocess.check_call(['/usr/share/easy-rsa/pkitool', '--initca'],
**COMMON_ARGS) **COMMON_ARGS)
subprocess.check_call(['/usr/share/easy-rsa/pkitool', '--server', subprocess.check_call(
'server'], **COMMON_ARGS) ['/usr/share/easy-rsa/pkitool', '--server', 'server'], **COMMON_ARGS)
subprocess.check_call(['/usr/share/easy-rsa/build-dh'], **COMMON_ARGS) subprocess.check_call(['/usr/share/easy-rsa/build-dh'], **COMMON_ARGS)
@ -224,8 +224,8 @@ def _is_non_empty_file(filepath):
def load_augeas(): def load_augeas():
"""Initialize Augeas.""" """Initialize Augeas."""
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + aug = augeas.Augeas(
augeas.Augeas.NO_MODL_AUTOLOAD) flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD)
# shell-script config file lens # shell-script config file lens
aug.set('/augeas/load/Simplevars/lens', 'Simplevars.lns') aug.set('/augeas/load/Simplevars/lens', 'Simplevars.lns')

View File

@ -14,7 +14,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
""" """
Plinth module to configure OpenVPN server. Plinth module to configure OpenVPN server.
""" """
@ -57,13 +56,14 @@ description = [
def init(): def init():
"""Initialize the OpenVPN module.""" """Initialize the OpenVPN module."""
menu = main_menu.get('apps') menu = main_menu.get('apps')
menu.add_urlname(name, 'glyphicon-lock', 'openvpn:index', short_description) menu.add_urlname(name, 'glyphicon-lock', 'openvpn:index',
short_description)
global service global service
setup_helper = globals()['setup_helper'] setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup': if setup_helper.get_state() != 'needs-setup':
service = service_module.Service( service = service_module.Service(managed_services[0], name,
managed_services[0], name, ports=['openvpn'], is_external=True) ports=['openvpn'], is_external=True)
if service.is_enabled() and is_setup(): if service.is_enabled() and is_setup():
add_shortcut() add_shortcut()
@ -75,9 +75,9 @@ def setup(helper, old_version=None):
helper.call('post', actions.superuser_run, 'openvpn', ['upgrade']) helper.call('post', actions.superuser_run, 'openvpn', ['upgrade'])
global service global service
if service is None: if service is None:
service = service_module.Service( service = service_module.Service(managed_services[0], name,
managed_services[0], name, ports=['openvpn'], is_external=True, ports=['openvpn'], is_external=True,
enable=enable, disable=disable) enable=enable, disable=disable)
def add_shortcut(): def add_shortcut():
@ -86,11 +86,10 @@ def add_shortcut():
format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">' format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">'
'Download Profile</a>'), 'Download Profile</a>'),
link=reverse_lazy('openvpn:profile')) link=reverse_lazy('openvpn:profile'))
frontpage.add_shortcut('openvpn', name, frontpage.add_shortcut(
short_description=short_description, 'openvpn', name, short_description=short_description,
details=description + [download_profile], details=description + [download_profile],
configure_url=reverse_lazy('openvpn:index'), configure_url=reverse_lazy('openvpn:index'), login_required=True)
login_required=True)
def is_setup(): def is_setup():