Example #1
0
def cluster(request, log_cli_level):
    """
    This fixture initiates deployment for both OCP and OCS clusters.
    Specific platform deployment classes will handle the fine details
    of action
    """
    log.info(f"All logs located at {ocsci_log_path()}")

    teardown = config.RUN['cli_params']['teardown']
    deploy = config.RUN['cli_params']['deploy']
    factory = dep_factory.DeploymentFactory()
    deployer = factory.get_deployment()

    # Add a finalizer to teardown the cluster after test execution is finished
    if teardown:

        def cluster_teardown_finalizer():
            deployer.destroy_cluster(log_cli_level)

        request.addfinalizer(cluster_teardown_finalizer)
        log.info("Will teardown cluster because --teardown was provided")

    # Download client
    force_download = (config.RUN['cli_params'].get('deploy')
                      and config.DEPLOYMENT['force_download_client'])
    get_openshift_client(force_download=force_download)

    if deploy:
        # Deploy cluster
        deployer.deploy_cluster(log_cli_level)
Example #2
0
def cluster(request, log_cli_level):
    """
    This fixture initiates deployment for both OCP and OCS clusters.
    Specific platform deployment classes will handle the fine details
    of action
    """
    log.info(f"All logs located at {ocsci_log_path()}")

    teardown = config.RUN['cli_params']['teardown']
    deploy = config.RUN['cli_params']['deploy']
    factory = dep_factory.DeploymentFactory()
    deployer = factory.get_deployment()

    # Add a finalizer to teardown the cluster after test execution is finished
    if teardown:

        def cluster_teardown_finalizer():
            deployer.destroy_cluster(log_cli_level)

        request.addfinalizer(cluster_teardown_finalizer)
        log.info("Will teardown cluster because --teardown was provided")

    # Download client
    force_download = (config.RUN['cli_params'].get('deploy')
                      and config.DEPLOYMENT['force_download_client'])
    get_openshift_client(force_download=force_download)

    if deploy:
        # Deploy cluster
        deployer.deploy_cluster(log_cli_level)
        # Workaround for #1777384 - enable container_use_cephfs on RHEL workers
        ocp_obj = ocp.OCP()
        cmd = ['/usr/sbin/setsebool -P container_use_cephfs on']
        workers = get_typed_worker_nodes(os_id="rhel")
        for worker in workers:
            cmd_list = cmd.copy()
            node = worker.get().get('metadata').get('name')
            log.info(f"{node} is a RHEL based worker - applying '{cmd_list}'")
            ocp_obj.exec_oc_debug_cmd(node=node, cmd_list=cmd_list)