mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
ejabberd: Prevent restart on freedombox startup
Closes: #1641 Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
b87930406e
commit
29ae2edcd1
@ -20,6 +20,7 @@ Configuration helper for the ejabberd service
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
@ -46,6 +47,10 @@ def parse_arguments():
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||||
|
|
||||||
|
# Get configuration
|
||||||
|
subparsers.add_parser('get-configuration',
|
||||||
|
help='Return the current configuration')
|
||||||
|
|
||||||
# Preseed debconf values before packages are installed.
|
# Preseed debconf values before packages are installed.
|
||||||
pre_install = subparsers.add_parser(
|
pre_install = subparsers.add_parser(
|
||||||
'pre-install',
|
'pre-install',
|
||||||
@ -93,6 +98,14 @@ def parse_arguments():
|
|||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def subcommand_get_configuration(_):
|
||||||
|
"""Return the current configuration, specifically domains configured."""
|
||||||
|
with open(EJABBERD_CONFIG, 'r') as file_handle:
|
||||||
|
conf = ruamel.yaml.round_trip_load(file_handle, preserve_quotes=True)
|
||||||
|
|
||||||
|
print(json.dumps({'domains': conf['hosts']}))
|
||||||
|
|
||||||
|
|
||||||
def subcommand_pre_install(arguments):
|
def subcommand_pre_install(arguments):
|
||||||
"""Preseed debconf values before packages are installed."""
|
"""Preseed debconf values before packages are installed."""
|
||||||
domainname = arguments.domainname
|
domainname = arguments.domainname
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
FreedomBox app to configure ejabberd server.
|
FreedomBox app to configure ejabberd server.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
@ -196,6 +197,9 @@ def on_post_hostname_change(sender, old_hostname, new_hostname, **kwargs):
|
|||||||
def on_domain_added(sender, domain_type, name, description='', services=None,
|
def on_domain_added(sender, domain_type, name, description='', services=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Update ejabberd config after domain name change."""
|
"""Update ejabberd config after domain name change."""
|
||||||
|
conf = actions.superuser_run('ejabberd', ['get-configuration'])
|
||||||
|
conf = json.loads(conf)
|
||||||
|
if name not in conf['domains']:
|
||||||
actions.superuser_run('ejabberd', ['add-domain', '--domainname', name])
|
actions.superuser_run('ejabberd', ['add-domain', '--domainname', name])
|
||||||
app.get_component('letsencrypt-ejabberd').setup_certificates()
|
app.get_component('letsencrypt-ejabberd').setup_certificates()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user