configpanel: rename data methods

This commit is contained in:
axolotle 2023-04-08 14:09:11 +02:00
parent 67687b7cff
commit ba32078180
4 changed files with 19 additions and 19 deletions

View file

@ -1882,7 +1882,7 @@ class AppConfigPanel(ConfigPanel):
env = {key: str(value) for key, value in self.new_values.items()}
self._call_config_script(action, env=env)
def _load_current_values(self):
def _get_raw_settings(self):
self.values = self._call_config_script("show")
def _apply(self):

View file

@ -555,8 +555,8 @@ class DomainConfigPanel(ConfigPanel):
return result
def _get_toml(self):
toml = super()._get_toml()
def _get_raw_config(self):
toml = super()._get_raw_config()
toml["feature"]["xmpp"]["xmpp"]["default"] = (
1 if self.entity == _get_maindomain() else 0
@ -571,7 +571,7 @@ class DomainConfigPanel(ConfigPanel):
toml["dns"]["registrar"] = _get_registrar_config_section(self.entity)
# FIXME: Ugly hack to save the registar id/value and reinject it in _load_current_values ...
# FIXME: Ugly hack to save the registar id/value and reinject it in _get_raw_settings ...
self.registar_id = toml["dns"]["registrar"]["registrar"]["value"]
del toml["dns"]["registrar"]["registrar"]["value"]
@ -594,21 +594,21 @@ class DomainConfigPanel(ConfigPanel):
f"domain_config_cert_summary_{status['summary']}"
)
# FIXME: Ugly hack to save the cert status and reinject it in _load_current_values ...
# FIXME: Ugly hack to save the cert status and reinject it in _get_raw_settings ...
self.cert_status = status
return toml
def _load_current_values(self):
def _get_raw_settings(self):
# TODO add mechanism to share some settings with other domains on the same zone
super()._load_current_values()
super()._get_raw_settings()
# FIXME: Ugly hack to save the registar id/value and reinject it in _load_current_values ...
# FIXME: Ugly hack to save the registar id/value and reinject it in _get_raw_settings ...
filter_key = self.filter_key.split(".") if self.filter_key != "" else []
if not filter_key or filter_key[0] == "dns":
self.values["registrar"] = self.registar_id
# FIXME: Ugly hack to save the cert status and reinject it in _load_current_values ...
# FIXME: Ugly hack to save the cert status and reinject it in _get_raw_settings ...
if not filter_key or filter_key[0] == "cert":
self.values["cert_validity"] = self.cert_status["validity"]
self.values["cert_issuer"] = self.cert_status["CA_type"]

View file

@ -180,8 +180,8 @@ class SettingsConfigPanel(ConfigPanel):
logger.success(m18n.n("global_settings_reset_success"))
operation_logger.success()
def _get_toml(self):
toml = super()._get_toml()
def _get_raw_config(self):
toml = super()._get_raw_config()
# Dynamic choice list for portal themes
THEMEDIR = "/usr/share/ssowat/portal/assets/themes/"
@ -193,8 +193,8 @@ class SettingsConfigPanel(ConfigPanel):
return toml
def _load_current_values(self):
super()._load_current_values()
def _get_raw_settings(self):
super()._get_raw_settings()
# Specific logic for those settings who are "virtual" settings
# and only meant to have a custom setter mapped to tools_rootpw

View file

@ -116,7 +116,7 @@ class ConfigPanel:
raise YunohostValidationError("config_no_panel")
# Read or get values and hydrate the config
self._load_current_values()
self._get_raw_settings()
self._hydrate()
# In 'classic' mode, we display the current value if key refer to an option
@ -200,7 +200,7 @@ class ConfigPanel:
self._parse_pre_answered(args, value, args_file)
# Read or get values and hydrate the config
self._load_current_values()
self._get_raw_settings()
self._hydrate()
BaseOption.operation_logger = operation_logger
self._ask()
@ -271,7 +271,7 @@ class ConfigPanel:
self._parse_pre_answered(args, None, args_file)
# Read or get values and hydrate the config
self._load_current_values()
self._get_raw_settings()
self._hydrate()
BaseOption.operation_logger = operation_logger
self._ask(action=action_id)
@ -310,7 +310,7 @@ class ConfigPanel:
logger.success(f"Action {action_id} successful")
operation_logger.success()
def _get_toml(self):
def _get_raw_config(self):
return read_toml(self.config_path)
def _get_config_panel(self):
@ -326,7 +326,7 @@ class ConfigPanel:
logger.debug(f"Config panel {self.config_path} doesn't exists")
return None
toml_config_panel = self._get_toml()
toml_config_panel = self._get_raw_config()
# Check TOML config panel is in a supported version
if float(toml_config_panel["version"]) < CONFIG_PANEL_VERSION_SUPPORTED:
@ -495,7 +495,7 @@ class ConfigPanel:
if "default" in option
}
def _load_current_values(self):
def _get_raw_settings(self):
"""
Retrieve entries in YAML file
And set default values if needed