mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
configpanel: update _reload_services
This commit is contained in:
parent
f1038de56d
commit
2c35dcbb24
1 changed files with 12 additions and 5 deletions
|
@ -199,6 +199,17 @@ class ConfigPanelModel(BaseModel):
|
||||||
# FIXME raise error?
|
# FIXME raise error?
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def services(self) -> list[str]:
|
||||||
|
services = set()
|
||||||
|
for panel in self.panels:
|
||||||
|
services |= set(panel.services)
|
||||||
|
for section in panel.sections:
|
||||||
|
services |= set(section.services)
|
||||||
|
|
||||||
|
services_ = list(services)
|
||||||
|
services_.sort(key="nginx".__eq__)
|
||||||
|
return services_
|
||||||
|
|
||||||
def iter_children(
|
def iter_children(
|
||||||
self,
|
self,
|
||||||
|
@ -701,12 +712,8 @@ class ConfigPanel:
|
||||||
def _reload_services(self):
|
def _reload_services(self):
|
||||||
from yunohost.service import service_reload_or_restart
|
from yunohost.service import service_reload_or_restart
|
||||||
|
|
||||||
services_to_reload = set()
|
services_to_reload = self.config.services
|
||||||
for panel, section, obj in self._iterate(["panel", "section", "option"]):
|
|
||||||
services_to_reload |= set(obj.get("services", []))
|
|
||||||
|
|
||||||
services_to_reload = list(services_to_reload)
|
|
||||||
services_to_reload.sort(key="nginx".__eq__)
|
|
||||||
if services_to_reload:
|
if services_to_reload:
|
||||||
logger.info("Reloading services...")
|
logger.info("Reloading services...")
|
||||||
for service in services_to_reload:
|
for service in services_to_reload:
|
||||||
|
|
Loading…
Add table
Reference in a new issue