toolforge.etcdctl

Wrapper around etcdctl handling parameters and such.

exception spicerack.toolforge.etcdctl.TooManyHosts[source]

Bases: SpicerackError

Raised when there's more hosts than supported passed.

exception spicerack.toolforge.etcdctl.UnableToParseOutput[source]

Bases: SpicerackError

Raised when there's an error trying to parse etcdctl output.

class spicerack.toolforge.etcdctl.EtcdClusterHealthStatus(global_status: spicerack.toolforge.etcdctl.HealthStatus, members_status: dict[str, spicerack.toolforge.etcdctl.HealthStatus]) None[source]

Bases: object

Etcd cluster health status.

class spicerack.toolforge.etcdctl.EtcdctlController(*, remote_host: spicerack.remote.RemoteHosts)[source]

Bases: RemoteHostsAdapter

Node that is able to run etcdctl and control an etcd cluster.

Init.

ensure_node_does_not_exist(member_fqdn: str) str | None[source]

Ensure the non existance of an etcd member, removing it if present.

Makes sure that the given member_fqdn member is not part of the etcd cluster, returns its old member id or None if it was not there.

Return type:

typing.Optional[str]

ensure_node_exists(new_member_fqdn: str, member_peer_url: str | None = None) str[source]

Ensure the existance of an etcd member adding it if not present.

Makes sure that the given new_member_fqdn member exists and is part of the etcd cluster, and returns its member id.

Return type:

str

get_cluster_health() spicerack.toolforge.etcdctl.EtcdClusterHealthStatus[source]

Gets the current etcd cluster health status.

Return type:

spicerack.toolforge.etcdctl.EtcdClusterHealthStatus

get_cluster_info() dict[str, dict[str, str | int | bool]][source]

Gets the current etcd cluster information.

Return type:

dict[str, dict[str, typing.Union[str, int, bool]]]

class spicerack.toolforge.etcdctl.HealthStatus(value)[source]

Bases: Enum

Health status.