def run( ctx: click.core.Context, cluster_id: str, node_args: Tuple[str], sync_dir: Tuple[Path], dcos_login_uname: str, dcos_login_pw: str, test_env: bool, node: Tuple[str], env: Dict[str, str], transport: Transport, ) -> None: """ Run an arbitrary command on a node or multiple nodes. To use special characters such as single quotes in your command, wrap the whole command in double quotes. """ check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(), ) cluster_containers = ClusterContainers( cluster_id=cluster_id, transport=transport, ) cluster = cluster_containers.cluster for dcos_checkout_dir in sync_dir: sync_code_to_masters( cluster=cluster, dcos_checkout_dir=dcos_checkout_dir, sudo=False, ) inspect_command_name = command_path( sibling_ctx=ctx, command=inspect_cluster, ) hosts = get_nodes( cluster_id=cluster_id, cluster_representation=cluster_containers, node_references=node, inspect_command_name=inspect_command_name, ) for host in hosts: run_command( args=list(node_args), cluster=cluster, host=host, use_test_env=test_env, dcos_login_uname=dcos_login_uname, dcos_login_pw=dcos_login_pw, env=env, transport=transport, )
def run( cluster_id: str, node_args: Tuple[str], sync_dir: Tuple[Path], dcos_login_uname: str, dcos_login_pw: str, test_env: bool, env: Dict[str, str], aws_region: str, verbose: int, node: str, ) -> None: """ Run an arbitrary command on a node. To use special characters such as single quotes in your command, wrap the whole command in double quotes. """ # noqa: E501 set_logging(verbosity_level=verbose) check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(aws_region=aws_region), ) cluster_instances = ClusterInstances( cluster_id=cluster_id, aws_region=aws_region, ) cluster = cluster_instances.cluster host = _get_node( cluster_id=cluster_id, node_reference=node, aws_region=aws_region, ) for dcos_checkout_dir in sync_dir: sync_code_to_masters( cluster=cluster, dcos_checkout_dir=dcos_checkout_dir, dcos_variant=cluster_instances.dcos_variant, ) run_command( args=list(node_args), cluster=cluster, host=host, use_test_env=test_env, dcos_login_uname=dcos_login_uname, dcos_login_pw=dcos_login_pw, env=env, transport=Transport.SSH, )
def sync_code( cluster_id: str, dcos_checkout_dir: Path, ) -> None: """ Sync files from a DC/OS checkout to master nodes. """ check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(), ) cluster_vms = ClusterVMs(cluster_id=cluster_id) cluster = cluster_vms.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=dcos_checkout_dir, sudo=True, )
def sync_code( cluster_id: str, dcos_checkout_dir: str, verbose: int, ) -> None: """ Sync files from a DC/OS checkout to master nodes. """ set_logging(verbosity_level=verbose) check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(), ) cluster_vms = ClusterVMs(cluster_id=cluster_id) cluster = cluster_vms.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=Path(dcos_checkout_dir), dcos_variant=cluster_vms.dcos_variant, )
def sync_code( cluster_id: str, dcos_checkout_dir: Path, aws_region: str, ) -> None: """ Sync files from a DC/OS checkout to master nodes. """ check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(aws_region=aws_region), ) cluster_instances = ClusterInstances( cluster_id=cluster_id, aws_region=aws_region, ) cluster = cluster_instances.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=dcos_checkout_dir, sudo=True, )
def sync_code( cluster_id: str, dcos_checkout_dir: Path, transport: Transport, ) -> None: """ Sync files from a DC/OS checkout to master nodes. """ check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(), ) cluster_containers = ClusterContainers( cluster_id=cluster_id, transport=transport, ) cluster = cluster_containers.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=dcos_checkout_dir, sudo=False, )