openvpn: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa committed 2016-02-13 13:51:32 +05:30
1 parent 335eeccee9
commit b916d95a0b
3 files changed
+27 -23

No files matched your search

+23 -4
View File
@@ -25,23 +25,42 @@ from plinth import actions
from plinth import action_utils
from plinth import cfg
from plinth import service as service_module
from plinth.utils import format_lazy
version = 1
depends = ['apps']
title = _('Virtual Private Network (OpenVPN)')
description = [
format_lazy(
_('Virtual Private Network (VPN) is a technique for securely '
'connecting two devices in order to access resources of a '
'private network. While you are away from home, you can connect '
'to your {box_name} in order to join your home network and '
'access private/internal services provided by {box_name}. '
'You can also access the rest of the Internet via {box_name} '
'for added security and anonymity.'), box_name=_(cfg.box_name))
]
service = None
def init():
"""Intialize the OpenVPN module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('Virtual Private Network (OpenVPN)'), 'glyphicon-lock',
'openvpn:index', 850)
menu.add_urlname(title, 'glyphicon-lock', 'openvpn:index', 850)
global service
service = service_module.Service(
'openvpn', _('OpenVPN'), ['openvpn'],
is_external=True, enabled=is_enabled())
'openvpn', title, ['openvpn'], is_external=True, enabled=is_enabled())
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(['openvpn', 'easy-rsa'])
def is_enabled():
+2 -16
View File
@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "app.html" %}
{% comment %}
#
# This file is part of Plinth.
@@ -30,21 +30,7 @@
{% endblock %}
{% block content %}
<h2>{% trans "Virtual Private Network (OpenVPN)" %}</h2>
<p>
{% blocktrans trimmed %}
Virtual Private Network (VPN) is a technique for securely
connecting two devices in order to access resources of a
private network. While you are away from home, you can connect
to your {{ box_name }} in order to join your home network and
access private/internal services provided by {{ box_name }}.
You can also access the rest of the Internet via {{ box_name }}
for added security and anonymity.
{% endblocktrans %}
</p>
{% block configuration %}
{% if status.is_setup %}
+2 -3
View File
@@ -29,7 +29,6 @@ import logging
from .forms import OpenVpnForm
from plinth import actions
from plinth import package
from plinth.modules import openvpn
from plinth.modules.config import config
@@ -38,7 +37,6 @@ logger = logging.getLogger(__name__)
setup_process = None
@package.required(['openvpn', 'easy-rsa'])
def index(request):
"""Serve configuration page."""
status = get_status()
@@ -59,7 +57,8 @@ def index(request):
form = OpenVpnForm(initial=status, prefix='openvpn')
return TemplateResponse(request, 'openvpn.html',
{'title': _('Virtual Private Network (OpenVPN)'),
{'title': openvpn.title,
'description': openvpn.description,
'status': status,
'form': form})