def sync_code( cluster_id: str, dcos_checkout_dir: str, transport: Transport, ) -> None: """ Sync files from a DC/OS checkout to master nodes. This syncs integration test files and bootstrap files. ``DCOS_CHECKOUT_DIR`` should be set to the path of clone of an open source DC/OS or DC/OS Enterprise repository. By default the ``DCOS_CHECKOUT_DIR`` argument is set to the value of the ``DCOS_CHECKOUT_DIR`` environment variable. If no ``DCOS_CHECKOUT_DIR`` is given, the current working directory is used. """ cluster_containers = ClusterContainers( cluster_id=cluster_id, transport=transport, ) cluster = cluster_containers.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=Path(dcos_checkout_dir), )
def sync_code( cluster_id: str, dcos_checkout_dir: str, verbose: int, ) -> None: """ Sync files from a DC/OS checkout to master nodes. This syncs integration test files and bootstrap files. ``DCOS_CHECKOUT_DIR`` should be set to the path of clone of an open source DC/OS or DC/OS Enterprise repository. By default the ``DCOS_CHECKOUT_DIR`` argument is set to the value of the ``DCOS_CHECKOUT_DIR`` environment variable. If no ``DCOS_CHECKOUT_DIR`` is given, the current working directory is used. """ set_logging(verbosity_level=verbose) check_cluster_id_exists( new_cluster_id=cluster_id, existing_cluster_ids=existing_cluster_ids(), ) cluster_containers = ClusterVMs(cluster_id=cluster_id) cluster = cluster_containers.cluster sync_code_to_masters( cluster=cluster, dcos_checkout_dir=Path(dcos_checkout_dir), )
def run( cluster_id: str, node_args: Tuple[str], sync_dir: Optional[Path], dcos_login_uname: str, dcos_login_pw: str, no_test_env: bool, env: Dict[str, str], aws_region: str, verbose: int, node: str, ) -> None: """ Run an arbitrary command on a node. This command sets up the environment so that ``pytest`` can be run. For example, run ``dcos-aws run --cluster-id 1231599 pytest -k test_tls.py``. Or, with sync: ``dcos-aws run --sync-dir . --cluster-id 1231599 pytest -k test_tls.py``. 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, ) if sync_dir is not None: sync_code_to_masters( cluster=cluster, dcos_checkout_dir=sync_dir, ) run_command( args=list(node_args), cluster=cluster, host=host, use_test_env=not no_test_env, dcos_login_uname=dcos_login_uname, dcos_login_pw=dcos_login_pw, env=env, transport=Transport.SSH, )
def run( cluster_id: str, node_args: Tuple[str], sync_dir: Optional[Path], dcos_login_uname: str, dcos_login_pw: str, no_test_env: bool, node: str, env: Dict[str, str], transport: Transport, ) -> None: """ Run an arbitrary command on a node. This command sets up the environment so that ``pytest`` can be run. For example, run ``dcos-docker run --cluster-id 1231599 pytest -k test_tls.py``. Or, with sync: ``dcos-docker run --sync-dir . --cluster-id 1231599 pytest -k test_tls.py``. To use special characters such as single quotes in your command, wrap the whole command in double quotes. """ # noqa: E501 host = _get_node(cluster_id=cluster_id, node_reference=node) cluster_containers = ClusterContainers( cluster_id=cluster_id, transport=transport, ) cluster = cluster_containers.cluster if sync_dir is not None: sync_code_to_masters( cluster=cluster, dcos_checkout_dir=sync_dir, ) run_command( args=list(node_args), cluster=cluster, host=host, use_test_env=not no_test_env, dcos_login_uname=dcos_login_uname, dcos_login_pw=dcos_login_pw, env=env, transport=transport, )