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()} env = {key: str(value) for key, value in self.new_values.items()}
self._call_config_script(action, env=env) self._call_config_script(action, env=env)
def _load_current_values(self): def _get_raw_settings(self):
self.values = self._call_config_script("show") self.values = self._call_config_script("show")
def _apply(self): def _apply(self):

View file

@ -555,8 +555,8 @@ class DomainConfigPanel(ConfigPanel):
return result return result
def _get_toml(self): def _get_raw_config(self):
toml = super()._get_toml() toml = super()._get_raw_config()
toml["feature"]["xmpp"]["xmpp"]["default"] = ( toml["feature"]["xmpp"]["xmpp"]["default"] = (
1 if self.entity == _get_maindomain() else 0 1 if self.entity == _get_maindomain() else 0
@ -571,7 +571,7 @@ class DomainConfigPanel(ConfigPanel):
toml["dns"]["registrar"] = _get_registrar_config_section(self.entity) 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"] self.registar_id = toml["dns"]["registrar"]["registrar"]["value"]
del 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']}" 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 self.cert_status = status
return toml 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 # 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 [] filter_key = self.filter_key.split(".") if self.filter_key != "" else []
if not filter_key or filter_key[0] == "dns": if not filter_key or filter_key[0] == "dns":
self.values["registrar"] = self.registar_id 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": if not filter_key or filter_key[0] == "cert":
self.values["cert_validity"] = self.cert_status["validity"] self.values["cert_validity"] = self.cert_status["validity"]
self.values["cert_issuer"] = self.cert_status["CA_type"] 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")) logger.success(m18n.n("global_settings_reset_success"))
operation_logger.success() operation_logger.success()
def _get_toml(self): def _get_raw_config(self):
toml = super()._get_toml() toml = super()._get_raw_config()
# Dynamic choice list for portal themes # Dynamic choice list for portal themes
THEMEDIR = "/usr/share/ssowat/portal/assets/themes/" THEMEDIR = "/usr/share/ssowat/portal/assets/themes/"
@ -193,8 +193,8 @@ class SettingsConfigPanel(ConfigPanel):
return toml return toml
def _load_current_values(self): def _get_raw_settings(self):
super()._load_current_values() super()._get_raw_settings()
# Specific logic for those settings who are "virtual" settings # Specific logic for those settings who are "virtual" settings
# and only meant to have a custom setter mapped to tools_rootpw # 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") raise YunohostValidationError("config_no_panel")
# Read or get values and hydrate the config # Read or get values and hydrate the config
self._load_current_values() self._get_raw_settings()
self._hydrate() self._hydrate()
# In 'classic' mode, we display the current value if key refer to an option # 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) self._parse_pre_answered(args, value, args_file)
# Read or get values and hydrate the config # Read or get values and hydrate the config
self._load_current_values() self._get_raw_settings()
self._hydrate() self._hydrate()
BaseOption.operation_logger = operation_logger BaseOption.operation_logger = operation_logger
self._ask() self._ask()
@ -271,7 +271,7 @@ class ConfigPanel:
self._parse_pre_answered(args, None, args_file) self._parse_pre_answered(args, None, args_file)
# Read or get values and hydrate the config # Read or get values and hydrate the config
self._load_current_values() self._get_raw_settings()
self._hydrate() self._hydrate()
BaseOption.operation_logger = operation_logger BaseOption.operation_logger = operation_logger
self._ask(action=action_id) self._ask(action=action_id)
@ -310,7 +310,7 @@ class ConfigPanel:
logger.success(f"Action {action_id} successful") logger.success(f"Action {action_id} successful")
operation_logger.success() operation_logger.success()
def _get_toml(self): def _get_raw_config(self):
return read_toml(self.config_path) return read_toml(self.config_path)
def _get_config_panel(self): def _get_config_panel(self):
@ -326,7 +326,7 @@ class ConfigPanel:
logger.debug(f"Config panel {self.config_path} doesn't exists") logger.debug(f"Config panel {self.config_path} doesn't exists")
return None return None
toml_config_panel = self._get_toml() toml_config_panel = self._get_raw_config()
# Check TOML config panel is in a supported version # Check TOML config panel is in a supported version
if float(toml_config_panel["version"]) < CONFIG_PANEL_VERSION_SUPPORTED: if float(toml_config_panel["version"]) < CONFIG_PANEL_VERSION_SUPPORTED:
@ -495,7 +495,7 @@ class ConfigPanel:
if "default" in option if "default" in option
} }
def _load_current_values(self): def _get_raw_settings(self):
""" """
Retrieve entries in YAML file Retrieve entries in YAML file
And set default values if needed And set default values if needed