genvid.toolbox.Clusters

class genvid.toolbox.Clusters(**kwargs)

Bases: genvid.toolbox.bastion_api.BastionAPI

This class is used as a base class to manage clusters

cluster_create(cluster_id: str)

Create a cluster :param cluster_id:

cluster_delete(cluster_id: str)

Delete a cluster :param cluster_id:

cluster_list()

Print the list of clusters

cluster_show(cluster_id: str)

Show a cluster information :param cluster_id:

commands_latest(clusters: typing.List[str] = None, globalcontext=False, **kwargs)

Print the latest command logs :param clusters: The list of clusters :param globalcontext: The global context :param kwargs:

commands_list(clusters: typing.List[str] = None, globalcontext=False, **kwargs)

Show the list of commands :param clusters: The list of clusters :param globalcontext: The global context :param kwargs:

commands_log(clusters: typing.List[str] = None, globalcontext=False, command_id: str = '', **kwargs)

Print a command logs :param clusters: The list of clusters :param globalcontext: The global context :param command_id: The command id :param kwargs:

execute_action(action: str = None, cluster_id: str = None, instance_id: str = None, silent: bool = False, **kwargs)

Execute an action :param action: plan, apply, destroy or refresh :param cluster_id: The cluster id. May be empty for the global context :param instance_id: The instance id :param silent: Do not print the commands logs :param kwargs: :return:

execute_clusters_action(action: str, clusters: typing.List[str] = None, silent: bool = False, **kwargs)

Execute an action for multiple clusters in parallel :param action: plan, apply, destroy or refresh :param clusters: The list of clusters :param silent: Do not print the commands logs :param kwargs: :return:

execute_global_action(action: str, globalcontext: bool = False, silent: bool = False, **kwargs)

Execute a global action :param action: plan, apply, destroy or refresh :param globalcontext: If the action is for global context :param silent: Do not print the commands logs :param kwargs:

get_instance_id(clusters: typing.List[str] = None, globalcontext: bool = False)

Get a single instance id. :param clusters: A list of cluster (must be a single one). :param globalcontext: The global context :return: A single instance or raise an exception :raises: ValueError if the number of instances are different than 1.

get_instances(clusters: typing.List[str] = None) → typing.List[dict]

Get the cluster instances :param clusters: The list of clusters

global_show()

Show the global configuration

global_tfvars_show()

Show the global ftvars

global_tfvars_update(tffile: str)

Update the global ftvars

global_update(bastion_id, source)

Update the global configuration

Parameters:
  • bastion_id – The bastion id
  • source – The terraform source path
terraform_apply(clusters: typing.List[str] = None, globalcontext=False, silent=False, **kwargs)

Execute a terraform apply :param clusters: The list of clusters :param globalcontext: The global context :param silent: Do not print :param kwargs:

terraform_destroy(clusters: typing.List[str] = None, globalcontext=False, silent=False, **kwargs)

Execute a terraform destroy :param clusters: The list of clusters :param globalcontext: The global context :param silent: Do not print :param kwargs:

terraform_get(clusters: typing.List[str] = None, globalcontext: bool = False)

Execute a terraform get. :param clusters: The list of clusters :param globalcontext: The global context

terraform_output(clusters: typing.List[str] = None, globalcontext=False, **kwargs)

Execute a terraform output :param clusters: The list of clusters :param globalcontext: The global context :param kwargs:

terraform_plan(clusters: typing.List[str] = None, globalcontext=False, destroy=False, silent=False, **kwargs)

Execute a terraform plan :param clusters: The list of clusters :param globalcontext: The global context :param destroy: If true, print a destroy plan :param silent: Do not print :param kwargs:

terraform_plan_apply(clusters: typing.List[str] = None, globalcontext=False, silent=False, **kwargs)

Execute a terraform plan for apply :param clusters: The list of clusters :param globalcontext: The global context :param silent: Do not print :param kwargs:

terraform_plan_destroy(clusters: typing.List[str] = None, globalcontext=False, silent=False, **kwargs)

Execute a terraform plan for destroy :param clusters: The list of clusters :param globalcontext: The global context :param silent: Do not print :param kwargs:

terraform_refresh(clusters: typing.List[str] = None, globalcontext=False, silent=False, **kwargs)

Execute a terraform refresh :param clusters: The list of clusters :param globalcontext: The global context :param silent: Do not print :param kwargs:

terraform_tfvars_default(clusters: typing.List[str] = None, globalcontext=False, **kwargs)

Show the default terraform.tfvars.json file :param clusters: The list of clusters :param globalcontext: The global context :param kwargs:

terraform_tfvars_show(clusters: typing.List[str] = None, globalcontext=False, **kwargs)

Show the terraform.tfvars.json file :param clusters: The list of clusters :param globalcontext: The global context :param kwargs:

terraform_tfvars_update(clusters: typing.List[str] = None, globalcontext=False, tffile: str = '', **kwargs)

Show the default terraform.tfvars.json file :param clusters: The list of clusters :param globalcontext: The global context :param file: The source file to update from :param kwargs: