Beispiel #1
0
def update_config(tentacles_setup_config, klass, config_update) -> None:
    config_file = _get_config_file_path(tentacles_setup_config, klass)
    current_config = configuration.read_config(config_file)
    # only update values in config update not to erase values in root config (might not be editable)
    current_config.update(config_update)
    config_file = _get_config_file_path(tentacles_setup_config,
                                        klass,
                                        updated_config=True)
    configuration.write_config(config_file, current_config)
Beispiel #2
0
 def read_config(self, tentacles_path=constants.TENTACLES_PATH):
     try:
         self._from_dict(configuration.read_config(self.config_path))
     except Exception as e:
         self.logger.error(f"Error when reading tentacles global configuration file ({e}), "
                           "resetting this file with default values. This will not change "
                           "any specific tentacle configuration.")
         loaders.ensure_tentacles_metadata(tentacles_path)
         self._update_tentacles_setup_config(loaders.get_tentacle_classes().values())
         self.save_config()
Beispiel #3
0
 def _refresh_profile_tentacles_config_file(self, tentacles, tentacles_config_file,
                                            newly_installed_tentacles, uninstalled_tentacles):
     profile_setup_config = TentaclesSetupConfiguration(config_path=tentacles_config_file)
     profile_setup_config._from_dict(configuration.read_config(profile_setup_config.config_path))
     # use self.registered_tentacles as a reference
     profile_setup_config.registered_tentacles = self.registered_tentacles
     self._refresh_other_tentacles_activation_from_self(profile_setup_config)
     profile_setup_config._update_tentacles_groups_activation(tentacles,
                                                              newly_installed_tentacles,
                                                              uninstalled_tentacles)
     profile_setup_config.save_config()
Beispiel #4
0
 def _update_tentacles_setup_config(self,
                                    tentacles,
                                    default_tentacle_config_file=constants.DEFAULT_TENTACLE_CONFIG,
                                    remove_missing_tentacles=True,
                                    newly_installed_tentacles=None,
                                    uninstalled_tentacles=None):
     default_config = configuration.read_config(default_tentacle_config_file)
     default_activation_config = default_config[self.TENTACLE_ACTIVATION_KEY] \
         if self.TENTACLE_ACTIVATION_KEY in default_config else {}
     for tentacle in tentacles:
         self._update_tentacle_activation(tentacle, default_activation_config)
     if remove_missing_tentacles:
         self._filter_tentacle_activation(tentacles)
     if newly_installed_tentacles or uninstalled_tentacles:
         self._update_tentacles_groups_activation(tentacles,
                                                  newly_installed_tentacles,
                                                  uninstalled_tentacles)
def get_config(tentacles_setup_config, klass) -> dict:
    return configuration.read_config(
        _get_config_file_path(tentacles_setup_config, klass))