diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 5c313f201b68..ede723115c0f 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -624,15 +624,29 @@ def exec_cmd( log.info(f"Executing command: {masked_cmd}") if isinstance(cmd, str) and not kwargs.get("shell"): cmd = shlex.split(cmd) - if ( - cluster_config - and cmd[0] == "oc" - and "--kubeconfig" not in cmd - #and config.multicluster - ): + if cluster_config and cmd[0] == "oc" and "--kubeconfig" not in cmd: kubepath = cluster_config.RUN["kubeconfig"] - cmd = list_insert_at_position(cmd, 1, ["--kubeconfig"]) - cmd = list_insert_at_position(cmd, 2, [kubepath]) + kube_index = 1 + # check if we have an oc plugin in the command + plugin_list = "oc plugin list" + cp = subprocess.run( + shlex.split(plugin_list), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + subcmd = cmd[1].split("-") + if len(subcmd) > 1: + subcmd = "_".join(subcmd) + log.debug(f"searching for plugin: {subcmd}") + + for l in cp.stdout.decode().splitlines(): + if subcmd in l: + # If oc cmdline has plugin name then we need to push the + # --kubeconfig to next index + kube_index = 2 + cmd = list_insert_at_position(cmd, kube_index, ["--kubeconfig"]) + cmd = list_insert_at_position(cmd, kube_index + 1, [kubepath]) + log.debug(f"Modified CMD = {cmd}") if threading_lock and cmd[0] == "oc": threading_lock.acquire() completed_process = subprocess.run( diff --git a/src/ocp-network-split b/src/ocp-network-split index 9c9a9461da96..d5ea5d042ff1 160000 --- a/src/ocp-network-split +++ b/src/ocp-network-split @@ -1 +1 @@ -Subproject commit 9c9a9461da965aaeb40fa949e21f3f7ff8441576 +Subproject commit d5ea5d042ff1709e10ce92755bbf147d361f253f