toolforge.etcdctl

Wrapper around etcdctl handling parameters and such.

exception spicerack.toolforge.etcdctl.TooManyHosts[source]

Bases: spicerack.exceptions.SpicerackError

Raised when there's more hosts than supported passed.

exception spicerack.toolforge.etcdctl.UnableToParseOutput[source]

Bases: spicerack.exceptions.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])[source]

Bases: object

Etcd cluster health status.

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

Bases: spicerack.remote.RemoteHostsAdapter

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

Init.

ensure_node_does_not_exist(member_fqdn: str) Optional[str][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.

ensure_node_exists(new_member_fqdn: str, member_peer_url: Optional[str] = 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.

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

Gets the current etcd cluster health status.

get_cluster_info() Dict[str, Dict[str, Union[str, int, bool]]][source]

Gets the current etcd cluster information.

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

Bases: enum.Enum

Health status.