waft.system.nodes.node_factory module

class waft.system.nodes.node_factory.NodeFactory

Bases: object

Factory for producing instances of a node

create(connection_details: ConnectionDetails, platform: Platforms | None = None, client: ClientBase | None = None, local: bool = False) BaseNode

Creates and returns a node instance based on the provided connection details and platform.

Args:

connection_details (ConnectionDetails): The details required to establish an SSH connection. platform (Optional[Platforms]): The platform of the remote system from the Platforms enum class client (Optional[ClientBase]): The client to connect to the remote system. local (bool): Flag to tell whether the node is the local system or not.

Returns:

BaseNode: An instance of a node appropriate for the specified or determined platform.

Raises:

ValueError: If the platform is unsupported or cannot be determined.

determine_client(connection_details: ConnectionDetails, local: bool = False) ClientBase

Determines the appropriate client type using the provided connection details. This method tests connections with the available clients and returns the client instance once a successful connection is established.

Args:

connection_details (ConnectionDetails): The connection details for the client. local (bool): Flag indicating if the node is to be the local node or not.

Returns:

ClientBase: The client instance that successfully established a connection.

platform_mapping: Dict[Platforms, Type[BaseNode]] = {Platforms.ALMALINUX: <class 'waft.system.nodes.almalinux_node.AlmaLinuxNode'>, Platforms.CENTOS: <class 'waft.system.nodes.centos_node.CentOSNode'>, Platforms.DEBIAN: <class 'waft.system.nodes.debian_node.DebianNode'>, Platforms.FEDORA: <class 'waft.system.nodes.fedora_node.FedoraNode'>, Platforms.MACOS: <class 'waft.system.nodes.macos_node.MacOSNode'>, Platforms.RHEL: <class 'waft.system.nodes.rhel_node.RedHatNode'>, Platforms.UBUNTU: <class 'waft.system.nodes.ubuntu_node.UbuntuNode'>, Platforms.WINDOWS: <class 'waft.system.nodes.windows_node.WindowsNode'>}