mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
config: Avoid sending domain_added signal for empty domain
- Fixes #1123 Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
714db18b3f
commit
bf1664aa9d
@ -20,8 +20,8 @@ Configuration helper for Cockpit.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import augeas
|
||||
|
||||
import augeas
|
||||
from plinth import action_utils
|
||||
|
||||
CONFIG_FILE = '/etc/cockpit/cockpit.conf'
|
||||
@ -32,10 +32,10 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
|
||||
subparser = subparsers.add_parser(
|
||||
'setup', help='Setup Cockpit configuration')
|
||||
subparser.add_argument(
|
||||
'domain_names', nargs='*', help='Domain names to be allowed')
|
||||
subparser = subparsers.add_parser('setup',
|
||||
help='Setup Cockpit configuration')
|
||||
subparser.add_argument('domain_names', nargs='*',
|
||||
help='Domain names to be allowed')
|
||||
subparsers.add_parser('enable', help='Enable Cockpit')
|
||||
subparsers.add_parser('disable', help='Disable Cockpit')
|
||||
subparser = subparsers.add_parser(
|
||||
@ -85,7 +85,7 @@ def subcommand_disable(_):
|
||||
def _get_origin_domains(aug):
|
||||
"""Return the list of allowed origin domains."""
|
||||
origins = aug.get('/files' + CONFIG_FILE + '/WebService/Origins')
|
||||
return set(origins.split())
|
||||
return set(origins.split()) if origins else set()
|
||||
|
||||
|
||||
def _set_origin_domains(aug, origins):
|
||||
|
||||
@ -14,21 +14,19 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Plinth module for basic system configuration
|
||||
"""
|
||||
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
from plinth.menu import main_menu
|
||||
from plinth.modules import firewall
|
||||
from plinth import actions
|
||||
from plinth.signals import domain_added
|
||||
from plinth.modules.names import SERVICES
|
||||
|
||||
import socket
|
||||
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
from plinth import actions
|
||||
from plinth.menu import main_menu
|
||||
from plinth.modules import firewall
|
||||
from plinth.modules.names import SERVICES
|
||||
from plinth.signals import domain_added
|
||||
|
||||
version = 1
|
||||
|
||||
@ -46,8 +44,8 @@ def get_domainname():
|
||||
def init():
|
||||
"""Initialize the module"""
|
||||
menu = main_menu.get('system')
|
||||
menu.add_urlname(ugettext_lazy('Configure'), 'glyphicon-cog',
|
||||
'config:index')
|
||||
menu.add_urlname(
|
||||
ugettext_lazy('Configure'), 'glyphicon-cog', 'config:index')
|
||||
|
||||
# Register domain with Name Services module.
|
||||
domainname = get_domainname()
|
||||
@ -62,7 +60,8 @@ def init():
|
||||
else:
|
||||
domainname_services = None
|
||||
|
||||
domain_added.send_robust(sender='config', domain_type='domainname',
|
||||
name=domainname,
|
||||
description=ugettext_lazy('Domain Name'),
|
||||
services=domainname_services)
|
||||
if domainname:
|
||||
domain_added.send_robust(sender='config', domain_type='domainname',
|
||||
name=domainname,
|
||||
description=ugettext_lazy('Domain Name'),
|
||||
services=domainname_services)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user