bind: forwarding works fine now

This commit is contained in:
mridulnagpal authored and James Valleroy committed 2017-01-06 18:17:19 -05:00
1 parent 95265426a9
commit 8c0d8e9db2
5 files changed
+21 -19

No files matched your search

+6 -12
View File
@@ -32,7 +32,7 @@ from plinth.views import ServiceView
version = 1
depends = ['apps']
depends = ['system']
title = _('Domain Name Server \n (BIND)')
@@ -55,10 +55,6 @@ description = [
CONFIG_FILE = '/etc/bind/named.conf.options'
value1 = 'acl goodclients { \n localhost;\n};\n'
value2 = ' recursion yes;\n allow-query { goodclients; };\n\n'
value3 = ' // 8.8.8.8;\n // 8.8.4.4;\n'
def init():
"""Intialize the BIND module."""
@@ -96,13 +92,11 @@ def setup(helper, old_version=None):
def enable():
"""Enable the module."""
actions.superuser_run('service', ['enable', managed_services[0]])
add_shortcut()
def disable():
"""Disable the module."""
actions.superuser_run('service', ['disable', managed_services[0]])
frontpage.remove_shortcut('bind')
def diagnose():
@@ -113,20 +107,20 @@ def diagnose():
results.append(action_utils.diagnose_port_listening(53, 'udp6'))
return results
def default_config():
"""Setp BIND configuration"""
actions.superuser_run('bind', ['setup'])
def get_default():
"""Get initial value for forwarding"""
f = open(CONFIG_FILE, "r")
contents = f.readlines()
if '// forwarders {' in contents:
data = [line.strip() for line in open(CONFIG_FILE, 'r')]
if '// forwarders {' in data:
conf = {
'set_forwarding': False}
else:
conf = {
'set_forwarding': True}
return conf
+2 -1
View File
@@ -29,4 +29,5 @@ class BindForm(ServiceForm):
"""BIND configuration form"""
set_forwarding = forms.BooleanField(
label=_('Enable forwarding'),
required=False)
required=False,
help_text=_('Enable forwarding on your BIND server'))
+2 -2
View File
@@ -21,9 +21,9 @@ URLs for the BIND module
from django.conf.urls import url
from plinth.modules.bind import BindServiceView
from plinth.modules.bind.views import BindServiceView
urlpatterns = [
url(r'^apps/bind/$', BindServiceView.as_view(), name='index'),
url(r'^sys/bind/$', BindServiceView.as_view(), name='index'),
]
+1 -1
View File
@@ -53,7 +53,7 @@ class BindServiceView(ServiceView): # pylint: disable=too-many-ancestors
value = 'true' if data['set_forwarding'] else 'false'
actions.superuser_run(
'bind',
['configure', '--set_forwarding', value])
['configure', '--set-forwarding', value])
messages.success(self.request,
_('Set forwarding configuration updated'))