Skip to content

Kathara.setting.Setting

Tommaso Caiazzi edited this page Jul 21, 2023 · 11 revisions

module Kathara.setting.Setting

Global Variables

  • AVAILABLE_DEBUG_LEVELS
  • AVAILABLE_MANAGERS
  • ONE_WEEK
  • DEFAULTS
  • SETTINGS_FILENAME
  • DEFAULT_SETTINGS_PATH

class Setting

Class responsible for interacting with Kathara Settings.

method Setting.__init__

__init__() → None

method Setting.check

check() → None

Check if Kathara is correctly working.

Check if the selected manager is available. Check the presence of Kathara updates. Check the correctness and validity of the net_prefix, device_prefix and debug level.

Returns: None

Raises:

  • SettingsError: If the Networks Prefix does not contain only lowercase letters and underscore.
  • SettingsError: If the Device Prefix does not contain only lowercase letters and underscore.
  • SettingsError: If the Debug Level specified is not allowed.

method Setting.check_image

check_image(image: 'str' = None) → None

Check if the specified image is valid.

Args:

  • image (str): The name of the image to check. If None, check the default image.

Returns: None

Raises:

  • ConnectionError: If the image is not locally available and there is no connection to a remote image repository.
  • ImageNotFoundError: If the image is not found.

method Setting.check_terminal

check_terminal(terminal: 'str' = None) → bool

Check that the selected terminal is available.

Args:

  • terminal (str): The selected terminal path. If None, check the availability of the default terminal.

Returns:

  • bool: True if the selected terminal is TMUX (that do not require path), else False.

Raises:

  • SettingError: If the terminal emulator specified is not found.

method Setting.get_instance

get_instance() → Setting

Return an instance of Setting.

Returns:

  • Kathara.setting.Setting: An instance of Setting.

Raises:

  • InstantiationError: If two instances of the class are created.

method Setting.load_from_dict

load_from_dict(settings: 'Dict[str, Any]') → None

Load settings from a dict.

Args:

  • settings (Dict[str, Any]): A dict containing the settings name as key and its value.

Returns: None


method Setting.load_from_disk

load_from_disk(path: 'Optional[str]' = None) → None

Load settings from a specific path on disk.

Args:

  • path (Optional[str]): A path where the kathara.conf file is stored. If None, default path is used.

Returns: None

Raises:

  • SettingsNotFound: If the Settings file is not found in specified path.
  • SettingsError: If the specified file is not a valid JSON.

method Setting.load_settings_addon

load_settings_addon() → None

Load a setting addon to the base settings.

Returns: None


method Setting.save_to_disk

save_to_disk(path: 'Optional[str]' = None) → None

Saves settings to a kathara.conf file in the specified path on disk.

Args:

  • path (Optional[str]): A path where the kathara.conf file will be stored. If None, default path is used.

Returns: None


method Setting.wipe_from_disk

wipe_from_disk() → None

Remove settings from the default settings path on disk.

Returns: None


This file was automatically generated via lazydocs.

Clone this wiki locally