mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Move firewall module to python logging
This commit is contained in:
parent
8d477fceb7
commit
b4183618c1
@ -22,12 +22,16 @@ Plinth module to configure a firewall
|
|||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
import logging
|
||||||
|
|
||||||
import actions
|
import actions
|
||||||
import cfg
|
import cfg
|
||||||
import service as service_module
|
import service as service_module
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initailze firewall module"""
|
"""Initailze firewall module"""
|
||||||
menu = cfg.main_menu.find('/sys')
|
menu = cfg.main_menu.find('/sys')
|
||||||
@ -99,7 +103,7 @@ def on_service_enabled(sender, service_id, enabled, **kwargs):
|
|||||||
internal_enabled_services = get_enabled_services(zone='internal')
|
internal_enabled_services = get_enabled_services(zone='internal')
|
||||||
external_enabled_services = get_enabled_services(zone='external')
|
external_enabled_services = get_enabled_services(zone='external')
|
||||||
|
|
||||||
cfg.log.info('Service enabled - %s, %s' % (service_id, enabled))
|
LOGGER.info('Service enabled - %s, %s', service_id, enabled)
|
||||||
service = service_module.SERVICES[service_id]
|
service = service_module.SERVICES[service_id]
|
||||||
for port in service.ports:
|
for port in service.ports:
|
||||||
if enabled:
|
if enabled:
|
||||||
@ -137,8 +141,7 @@ def _run(arguments, superuser=False):
|
|||||||
"""Run an given command and raise exception if there was an error"""
|
"""Run an given command and raise exception if there was an error"""
|
||||||
command = 'firewall'
|
command = 'firewall'
|
||||||
|
|
||||||
cfg.log.info('Running command - %s, %s, %s' % (command, arguments,
|
LOGGER.info('Running command - %s, %s, %s', command, arguments, superuser)
|
||||||
superuser))
|
|
||||||
|
|
||||||
if superuser:
|
if superuser:
|
||||||
output, error = actions.superuser_run(command, arguments)
|
output, error = actions.superuser_run(command, arguments)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user