From ba320781808cb1923e5467d9847edec4f5791fc4 Mon Sep 17 00:00:00 2001 From: axolotle Date: Sat, 8 Apr 2023 14:09:11 +0200 Subject: [PATCH] configpanel: rename data methods --- src/app.py | 2 +- src/domain.py | 16 ++++++++-------- src/settings.py | 8 ++++---- src/utils/configpanel.py | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/app.py b/src/app.py index 604fd9acb..97227ed0c 100644 --- a/src/app.py +++ b/src/app.py @@ -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): diff --git a/src/domain.py b/src/domain.py index d2997ab59..4f96d08c4 100644 --- a/src/domain.py +++ b/src/domain.py @@ -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"] diff --git a/src/settings.py b/src/settings.py index 26da14866..6690ab3fd 100644 --- a/src/settings.py +++ b/src/settings.py @@ -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 diff --git a/src/utils/configpanel.py b/src/utils/configpanel.py index 50380aad5..fcdaea193 100644 --- a/src/utils/configpanel.py +++ b/src/utils/configpanel.py @@ -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