Repository: red-hat-storage/ocs-ci
Issue: Downloading openshift client is broken

Some of the recent changes in `master` branch break the way how configuration files are loaded and processed, which leads to issue with downloading openshift client.
Fresh deployment (without already downloaded client) fails.
(removed unrelated parts)

```
$ run-ci tests/ecosystem/deployment -m deployment --cluster-name dahorak-cluster01 --cluster-path dahorak-cluster01
================================================ test session starts ================================================
platform linux -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.12.0
cachedir: .pytest_cache
rootdir: ocs-ci, inifile: pytest.ini
plugins: reportportal-1.0.5
collected 1 item                                                                                                    

tests/ecosystem/deployment/test_ocs_basic_install.py::TestDeployment::test_deployment 

  ...

16:03:04 - MainThread - utility.utils - INFO - Downloading openshift client
FAILED                                                                                                        [100%]

===================================================== FAILURES ======================================================
__________________________________________ TestDeployment.test_deployment ___________________________________________

self = <tests.ecosystem.deployment.test_ocs_basic_install.TestDeployment object at 0x7fb538fa4ef0>

    def test_deployment(self):
        log.info("Running OCS basic installation")
        cluster_path = ENV_DATA['cluster_path']
        # Test cluster access and if exist just skip the deployment.
        if RUN['cli_params'].get('cluster_path') and OCP.set_kubeconfig(
            os.path.join(cluster_path, RUN.get('kubeconfig_location'))
        ):
            pytest.skip(
                "The installation is skipped cause the cluster is running"
            )
    
        # Generate install-config from template
        log.info("Generating install-config")
        run_cmd(f"mkdir -p {cluster_path}")
        pull_secret_path = os.path.join(
            TOP_DIR,
            "data",
            "pull-secret"
        )
    
        # TODO: check for supported platform and raise the exception if not
        # supported. Currently we support just AWS.
    
        _templating = templating.Templating()
        install_config_str = _templating.render_template(
            "install-config.yaml.j2", ENV_DATA
        )
        # Parse the rendered YAML so that we can manipulate the object directly
        install_config_obj = yaml.safe_load(install_config_str)
        with open(pull_secret_path, "r") as f:
            # Parse, then unparse, the JSON file.
            # We do this for two reasons: to ensure it is well-formatted, and
            # also to ensure it ends up as a single line.
            install_config_obj['pullSecret'] = json.dumps(json.loads(f.read()))
        install_config_str = yaml.safe_dump(install_config_obj)
        log.info(f"Install config: \\n{install_config_str}")
        install_config = os.path.join(cluster_path, "install-config.yaml")
        with open(install_config, "w") as f:
            f.write(install_config_str)
    
        # Download installer
        installer = get_openshift_installer(
            DEPLOYMENT['installer_version']
        )
        # Download client
>       get_openshift_client()

../tests/ecosystem/deployment/test_ocs_basic_install.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../utility/utils.py:799: in get_openshift_client
    download_file(url, tarball)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

url = 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ DEPLOYMENT["installer_version"] }}/openshift-client-linux-{{ DEPLOYMENT["installer_version"] }}.tar.gz'
filename = 'openshift-client.tar.gz'

    def download_file(url, filename):
        """
        Download a file from a specified url
    
        Args:
            url (str): URL of the file to download
            filename (str): Name of the file to write the download to
    
        """
        with open(filename, "wb") as f:
            r = requests.get(url)
            f.write(r.content)
>       assert r.ok
E       AssertionError

../utility/utils.py:673: AssertionError
  ...
16:03:04 - MainThread - utility.utils - INFO - Downloading openshift client
16:03:04 - MainThread - utility.utils - DEBUG - Directory './bin' already exists.
16:03:04 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): mirror.openshift.com:443
16:03:05 - MainThread - urllib3.connectionpool - DEBUG - https://mirror.openshift.com:443 "GET /pub/openshift-v4/clients/ocp/%7B%7B%20DEPLOYMENT[%22installer_version%22]%20%7D%7D/openshift-client-linux-%7B%7B%20DEPLOYMENT[%22installer_version%22]%20%7D%7D.tar.gz HTTP/1.1" 404 440
============================================= 1 failed in 0.86 seconds ==============================================
```

The problem is, that the variables from `conf/ocsci/default_config.yaml` are
not properly processed and to `client_version` variable is assigned
`'{{ DEPLOYMENT["installer_version"] }}'` instead of the expected value.


### WORKAROUND
I didn't find the root cause yet, but there are 2 workarounds possible:

1) download openshift-client binaries manually and place it to `./bin` directory, or
2) set `client_version` in `conf/ocsci/default_config.yaml` file directly to the expected version `4.1.0`.


Changed files:
run_ocsci.py

diff --git a/run_ocsci.py b/run_ocsci.py
index 9e698554..27066f6e 100644
--- a/run_ocsci.py
+++ b/run_ocsci.py
@@ -8,7 +8,6 @@ import yaml
 
 from ocs import defaults
 from ocsci import config as ocsci_config
-from utility.utils import add_path_to_env_path
 
 
 HERE = os.path.abspath(os.path.dirname(__file__))
@@ -116,6 +115,7 @@ def main():
         '-p', 'ocsci.pytest_customization.marks',
         '-p', 'ocsci.pytest_customization.ocsci_logging',
     ])
+    from utility.utils import add_path_to_env_path
     add_path_to_env_path(os.path.join(HERE, 'bin'))
     exit(pytest.main(arguments))