electrolyt.host
===============

.. py:module:: electrolyt.host


Classes
-------

.. autoapisummary::

   electrolyt.host.Host
   electrolyt.host.HostDB


Module Contents
---------------

.. py:class:: Host(hostname: str, platform: str, version: str, **kwargs: Any)

   Bases: :py:obj:`e3.env.BaseEnv`


   Represent an host from the host database.

   See e3.env.BaseEnv


.. py:class:: HostDB(filename: str | None = None)

   Host database.

   :ivar hosts: dict indexed by host name


   .. py:attribute:: hosts
      :type:  dict[str, Host]


   .. py:property:: hostnames
      :type: list[str]


      Return the current list of host names.

      :return: a list of hostnames



   .. py:method:: add_host(hostname: str, platform: str, version: str, **data: Any) -> None

      Add/Update a host entry.

      :param hostname: host name
      :param platform: platform name (see e3.platform)
      :param version: platform/OS version
      :param data: additional host information



   .. py:method:: load_yaml_db(filename: str) -> None

      Load a yaml configuration file.

      The yaml file should be a dictionaty indexed by host name. Each entry
      should be a dictionary containing at least the following two keys:

      * build_platform: the platform name
      * build_os_version: the platform/os version

      Additional keys for a host entry will be considered as additional data

      :param filename: path the yaml file



   .. py:method:: __getitem__(key: str) -> Host


   .. py:method:: get(key: str, default: Host | None = None) -> Host | None

      Return the Host named ``key`` of ``default``.

      :param key: host name
      :param default: default value to return if not found



