mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Change binding from service_regen_conf to tools_regen_conf
This commit is contained in:
parent
3067e8e897
commit
e6f3a99269
9 changed files with 44 additions and 23 deletions
2
debian/postinst
vendored
2
debian/postinst
vendored
|
@ -12,7 +12,7 @@ do_configure() {
|
||||||
bash /usr/share/yunohost/hooks/conf_regen/15-nginx init
|
bash /usr/share/yunohost/hooks/conf_regen/15-nginx init
|
||||||
else
|
else
|
||||||
echo "Regenerating configuration, this might take a while..."
|
echo "Regenerating configuration, this might take a while..."
|
||||||
yunohost service regen-conf --output-as none
|
yunohost tools regen-conf --output-as none
|
||||||
|
|
||||||
echo "Launching migrations.."
|
echo "Launching migrations.."
|
||||||
yunohost tools migrations migrate --auto
|
yunohost tools migrations migrate --auto
|
||||||
|
|
|
@ -443,6 +443,7 @@
|
||||||
"service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}",
|
"service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}",
|
||||||
"service_enabled": "The service '{service:s}' has been enabled",
|
"service_enabled": "The service '{service:s}' has been enabled",
|
||||||
"service_no_log": "No log to display for service '{service:s}'",
|
"service_no_log": "No log to display for service '{service:s}'",
|
||||||
|
"service_regen_conf_is_deprecated": "'yunohost service regen-conf' is depracted! Please use 'yunohost tools regen-conf' instead.",
|
||||||
"service_remove_failed": "Unable to remove service '{service:s}'",
|
"service_remove_failed": "Unable to remove service '{service:s}'",
|
||||||
"service_removed": "The service '{service:s}' has been removed",
|
"service_removed": "The service '{service:s}' has been removed",
|
||||||
"service_reload_failed": "Unable to reload service '{service:s}'\n\nRecent service logs:{logs:s}",
|
"service_reload_failed": "Unable to reload service '{service:s}'\n\nRecent service logs:{logs:s}",
|
||||||
|
|
|
@ -50,7 +50,7 @@ from yunohost.hook import (
|
||||||
)
|
)
|
||||||
from yunohost.monitor import binary_to_human
|
from yunohost.monitor import binary_to_human
|
||||||
from yunohost.tools import tools_postinstall
|
from yunohost.tools import tools_postinstall
|
||||||
from yunohost.service import service_regen_conf
|
from yunohost.regenconf import regen_conf
|
||||||
from yunohost.log import OperationLogger
|
from yunohost.log import OperationLogger
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
|
@ -1191,7 +1191,7 @@ class RestoreManager():
|
||||||
else:
|
else:
|
||||||
operation_logger.success()
|
operation_logger.success()
|
||||||
|
|
||||||
service_regen_conf()
|
regen_conf()
|
||||||
|
|
||||||
def _restore_apps(self):
|
def _restore_apps(self):
|
||||||
"""Restore all apps targeted"""
|
"""Restore all apps targeted"""
|
||||||
|
|
|
@ -43,7 +43,8 @@ from yunohost.utils.network import get_public_ip
|
||||||
|
|
||||||
from moulinette import m18n
|
from moulinette import m18n
|
||||||
from yunohost.app import app_ssowatconf
|
from yunohost.app import app_ssowatconf
|
||||||
from yunohost.service import _run_service_command, service_regen_conf
|
from yunohost.service import _run_service_command
|
||||||
|
from yunohost.regenconf import regen_conf
|
||||||
from yunohost.log import OperationLogger
|
from yunohost.log import OperationLogger
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.certmanager')
|
logger = getActionLogger('yunohost.certmanager')
|
||||||
|
@ -806,7 +807,7 @@ def _enable_certificate(domain, new_cert_folder):
|
||||||
if os.path.isfile('/etc/yunohost/installed'):
|
if os.path.isfile('/etc/yunohost/installed'):
|
||||||
# regen nginx conf to be sure it integrates OCSP Stapling
|
# regen nginx conf to be sure it integrates OCSP Stapling
|
||||||
# (We don't do this yet if postinstall is not finished yet)
|
# (We don't do this yet if postinstall is not finished yet)
|
||||||
service_regen_conf(names=['nginx'])
|
regen_conf(names=['nginx'])
|
||||||
|
|
||||||
_run_service_command("reload", "nginx")
|
_run_service_command("reload", "nginx")
|
||||||
|
|
||||||
|
@ -924,7 +925,7 @@ def _regen_dnsmasq_if_needed():
|
||||||
break
|
break
|
||||||
|
|
||||||
if do_regen:
|
if do_regen:
|
||||||
service_regen_conf(["dnsmasq"])
|
regen_conf(["dnsmasq"])
|
||||||
|
|
||||||
|
|
||||||
def _name_self_CA():
|
def _name_self_CA():
|
||||||
|
|
|
@ -8,10 +8,10 @@ from moulinette.utils.log import getActionLogger
|
||||||
from moulinette.utils.filesystem import mkdir, rm
|
from moulinette.utils.filesystem import mkdir, rm
|
||||||
|
|
||||||
from yunohost.tools import Migration
|
from yunohost.tools import Migration
|
||||||
from yunohost.service import service_regen_conf, \
|
from yunohost.service import _get_conf_hashes, \
|
||||||
_get_conf_hashes, \
|
|
||||||
_calculate_hash, \
|
_calculate_hash, \
|
||||||
_run_service_command
|
_run_service_command
|
||||||
|
from yunohost.regen_conf import regen_conf
|
||||||
from yunohost.settings import settings_set
|
from yunohost.settings import settings_set
|
||||||
from yunohost.utils.error import YunohostError
|
from yunohost.utils.error import YunohostError
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class MyMigration(Migration):
|
||||||
if os.path.exists('/etc/yunohost/from_script'):
|
if os.path.exists('/etc/yunohost/from_script'):
|
||||||
rm('/etc/yunohost/from_script')
|
rm('/etc/yunohost/from_script')
|
||||||
copyfile(SSHD_CONF, '/etc/ssh/sshd_config.bkp')
|
copyfile(SSHD_CONF, '/etc/ssh/sshd_config.bkp')
|
||||||
service_regen_conf(names=['ssh'], force=True)
|
regen_conf(names=['ssh'], force=True)
|
||||||
copyfile('/etc/ssh/sshd_config.bkp', SSHD_CONF)
|
copyfile('/etc/ssh/sshd_config.bkp', SSHD_CONF)
|
||||||
|
|
||||||
# Restart ssh and backward if it fail
|
# Restart ssh and backward if it fail
|
||||||
|
|
|
@ -6,9 +6,9 @@ from moulinette.utils.log import getActionLogger
|
||||||
from moulinette.utils.filesystem import chown
|
from moulinette.utils.filesystem import chown
|
||||||
|
|
||||||
from yunohost.tools import Migration
|
from yunohost.tools import Migration
|
||||||
from yunohost.service import service_regen_conf, \
|
from yunohost.service import _get_conf_hashes, \
|
||||||
_get_conf_hashes, \
|
|
||||||
_calculate_hash
|
_calculate_hash
|
||||||
|
from yunohost.regenconf import regen_conf
|
||||||
from yunohost.settings import settings_set, settings_get
|
from yunohost.settings import settings_set, settings_get
|
||||||
from yunohost.utils.error import YunohostError
|
from yunohost.utils.error import YunohostError
|
||||||
from yunohost.backup import ARCHIVES_PATH
|
from yunohost.backup import ARCHIVES_PATH
|
||||||
|
@ -36,7 +36,7 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
settings_set("service.ssh.allow_deprecated_dsa_hostkey", False)
|
settings_set("service.ssh.allow_deprecated_dsa_hostkey", False)
|
||||||
service_regen_conf(names=['ssh'], force=True)
|
regen_conf(names=['ssh'], force=True)
|
||||||
|
|
||||||
# Update local archives folder permissions, so that
|
# Update local archives folder permissions, so that
|
||||||
# admin can scp archives out of the server
|
# admin can scp archives out of the server
|
||||||
|
|
|
@ -34,7 +34,7 @@ from moulinette.utils.log import getActionLogger
|
||||||
|
|
||||||
import yunohost.certificate
|
import yunohost.certificate
|
||||||
|
|
||||||
from yunohost.service import service_regen_conf
|
from yunohost.regenconf import regen_conf
|
||||||
from yunohost.utils.network import get_public_ip
|
from yunohost.utils.network import get_public_ip
|
||||||
from yunohost.log import is_unit_operation
|
from yunohost.log import is_unit_operation
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ def domain_add(operation_logger, auth, domain, dyndns=False):
|
||||||
|
|
||||||
# Don't regen these conf if we're still in postinstall
|
# Don't regen these conf if we're still in postinstall
|
||||||
if os.path.exists('/etc/yunohost/installed'):
|
if os.path.exists('/etc/yunohost/installed'):
|
||||||
service_regen_conf(names=['nginx', 'metronome', 'dnsmasq', 'postfix', 'rspamd'])
|
regen_conf(names=['nginx', 'metronome', 'dnsmasq', 'postfix', 'rspamd'])
|
||||||
app_ssowatconf(auth)
|
app_ssowatconf(auth)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -164,7 +164,7 @@ def domain_remove(operation_logger, auth, domain, force=False):
|
||||||
else:
|
else:
|
||||||
raise YunohostError('domain_deletion_failed')
|
raise YunohostError('domain_deletion_failed')
|
||||||
|
|
||||||
service_regen_conf(names=['nginx', 'metronome', 'dnsmasq', 'postfix'])
|
regen_conf(names=['nginx', 'metronome', 'dnsmasq', 'postfix'])
|
||||||
app_ssowatconf(auth)
|
app_ssowatconf(auth)
|
||||||
|
|
||||||
hook_callback('post_domain_remove', args=[domain])
|
hook_callback('post_domain_remove', args=[domain])
|
||||||
|
|
|
@ -410,6 +410,19 @@ def service_log(name, number=50):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def service_regen_conf(names=[], with_diff=False, force=False, dry_run=False,
|
||||||
|
list_pending=False):
|
||||||
|
|
||||||
|
services = _get_services()
|
||||||
|
for name in names:
|
||||||
|
if name not in services:
|
||||||
|
raise YunohostError('service_unknown', service=service)
|
||||||
|
|
||||||
|
logger.warning(m18n.n("service_regen_conf_is_deprecated"))
|
||||||
|
|
||||||
|
return regen_conf(names, with_diff, force, dry_run, list_pending)
|
||||||
|
|
||||||
|
|
||||||
def _run_service_command(action, service):
|
def _run_service_command(action, service):
|
||||||
"""
|
"""
|
||||||
Run services management command (start, stop, enable, disable, restart, reload)
|
Run services management command (start, stop, enable, disable, restart, reload)
|
||||||
|
|
|
@ -47,7 +47,8 @@ from yunohost.app import app_fetchlist, app_info, app_upgrade, app_ssowatconf, a
|
||||||
from yunohost.domain import domain_add, domain_list, _get_maindomain, _set_maindomain
|
from yunohost.domain import domain_add, domain_list, _get_maindomain, _set_maindomain
|
||||||
from yunohost.dyndns import _dyndns_available, _dyndns_provides
|
from yunohost.dyndns import _dyndns_available, _dyndns_provides
|
||||||
from yunohost.firewall import firewall_upnp
|
from yunohost.firewall import firewall_upnp
|
||||||
from yunohost.service import service_status, service_regen_conf, service_log, service_start, service_enable
|
from yunohost.service import service_status, service_log, service_start, service_enable
|
||||||
|
from yunohost.regenconf import regen_conf
|
||||||
from yunohost.monitor import monitor_disk, monitor_system
|
from yunohost.monitor import monitor_disk, monitor_system
|
||||||
from yunohost.utils.packages import ynh_packages_version
|
from yunohost.utils.packages import ynh_packages_version
|
||||||
from yunohost.utils.network import get_public_ip
|
from yunohost.utils.network import get_public_ip
|
||||||
|
@ -207,7 +208,7 @@ def tools_maindomain(operation_logger, auth, new_domain=None):
|
||||||
# Regen configurations
|
# Regen configurations
|
||||||
try:
|
try:
|
||||||
with open('/etc/yunohost/installed', 'r'):
|
with open('/etc/yunohost/installed', 'r'):
|
||||||
service_regen_conf()
|
regen_conf()
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -325,7 +326,7 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||||
operation_logger.start()
|
operation_logger.start()
|
||||||
logger.info(m18n.n('yunohost_installing'))
|
logger.info(m18n.n('yunohost_installing'))
|
||||||
|
|
||||||
service_regen_conf(['nslcd', 'nsswitch'], force=True)
|
regen_conf(['nslcd', 'nsswitch'], force=True)
|
||||||
|
|
||||||
# Initialize LDAP for YunoHost
|
# Initialize LDAP for YunoHost
|
||||||
# TODO: Improve this part by integrate ldapinit into conf_regen hook
|
# TODO: Improve this part by integrate ldapinit into conf_regen hook
|
||||||
|
@ -376,7 +377,7 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||||
os.system('chmod 644 /etc/ssowat/conf.json.persistent')
|
os.system('chmod 644 /etc/ssowat/conf.json.persistent')
|
||||||
|
|
||||||
# Create SSL CA
|
# Create SSL CA
|
||||||
service_regen_conf(['ssl'], force=True)
|
regen_conf(['ssl'], force=True)
|
||||||
ssl_dir = '/usr/share/yunohost/yunohost-config/ssl/yunoCA'
|
ssl_dir = '/usr/share/yunohost/yunohost-config/ssl/yunoCA'
|
||||||
# (Update the serial so that it's specific to this very instance)
|
# (Update the serial so that it's specific to this very instance)
|
||||||
os.system("openssl rand -hex 19 > %s/serial" % ssl_dir)
|
os.system("openssl rand -hex 19 > %s/serial" % ssl_dir)
|
||||||
|
@ -405,7 +406,7 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||||
logger.success(m18n.n('yunohost_ca_creation_success'))
|
logger.success(m18n.n('yunohost_ca_creation_success'))
|
||||||
|
|
||||||
# New domain config
|
# New domain config
|
||||||
service_regen_conf(['nsswitch'], force=True)
|
regen_conf(['nsswitch'], force=True)
|
||||||
domain_add(auth, domain, dyndns)
|
domain_add(auth, domain, dyndns)
|
||||||
tools_maindomain(auth, domain)
|
tools_maindomain(auth, domain)
|
||||||
|
|
||||||
|
@ -433,7 +434,7 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||||
service_enable("yunohost-firewall")
|
service_enable("yunohost-firewall")
|
||||||
service_start("yunohost-firewall")
|
service_start("yunohost-firewall")
|
||||||
|
|
||||||
service_regen_conf(force=True)
|
regen_conf(force=True)
|
||||||
|
|
||||||
# Restore original ssh conf, as chosen by the
|
# Restore original ssh conf, as chosen by the
|
||||||
# admin during the initial install
|
# admin during the initial install
|
||||||
|
@ -450,13 +451,18 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||||
else:
|
else:
|
||||||
# We need to explicitly ask the regen conf to regen ssh
|
# We need to explicitly ask the regen conf to regen ssh
|
||||||
# (by default, i.e. first argument = None, it won't because it's too touchy)
|
# (by default, i.e. first argument = None, it won't because it's too touchy)
|
||||||
service_regen_conf(names=["ssh"], force=True)
|
regen_conf(names=["ssh"], force=True)
|
||||||
|
|
||||||
logger.success(m18n.n('yunohost_configured'))
|
logger.success(m18n.n('yunohost_configured'))
|
||||||
|
|
||||||
logger.warning(m18n.n('recommend_to_add_first_user'))
|
logger.warning(m18n.n('recommend_to_add_first_user'))
|
||||||
|
|
||||||
|
|
||||||
|
def tools_regen_conf(names=[], with_diff=False, force=False, dry_run=False,
|
||||||
|
list_pending=False):
|
||||||
|
return regen_conf(names, with_diff, force, dry_run, list_pending)
|
||||||
|
|
||||||
|
|
||||||
def tools_update(ignore_apps=False, ignore_packages=False):
|
def tools_update(ignore_apps=False, ignore_packages=False):
|
||||||
"""
|
"""
|
||||||
Update apps & package cache, then display changelog
|
Update apps & package cache, then display changelog
|
||||||
|
@ -693,7 +699,7 @@ def tools_diagnosis(auth, private=False):
|
||||||
# Domains
|
# Domains
|
||||||
diagnosis['private']['domains'] = domain_list(auth)['domains']
|
diagnosis['private']['domains'] = domain_list(auth)['domains']
|
||||||
|
|
||||||
diagnosis['private']['regen_conf'] = service_regen_conf(with_diff=True, dry_run=True)
|
diagnosis['private']['regen_conf'] = regen_conf(with_diff=True, dry_run=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
diagnosis['security'] = {
|
diagnosis['security'] = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue