util: Fix tracevol to use --config for oc only

tracevol.py uses --config instead of --kubeconfig when invoked with
-c kubectl and -k <some_path> at the same time.

Signed-off-by: Santiago Sanchez Paz <sanchezpaz@gmail.com>
This commit is contained in:
Santiago Sanchez Paz 2020-08-13 18:07:16 +02:00 committed by mergify[bot]
parent 8c2bdbc001
commit 6ece9bed92

View File

@ -502,9 +502,10 @@ def get_pv_data(arg, pvname):
pvdata = {} pvdata = {}
cmd = [arg.command] cmd = [arg.command]
if arg.kubeconfig != "": if arg.kubeconfig != "":
cmd += ["--config", arg.kubeconfig] if arg.command == "oc":
else: cmd += ["--config", arg.kubeconfig]
cmd += ["--kubeconfig", arg.kubeconfig] else:
cmd += ["--kubeconfig", arg.kubeconfig]
cmd += ['get', 'pv', pvname, '-o', 'json'] cmd += ['get', 'pv', pvname, '-o', 'json']
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, out = subprocess.Popen(cmd, stdout=subprocess.PIPE,