Skip to content

Commit

Permalink
Fix output redirection issues
Browse files Browse the repository at this point in the history
Signed-off-by: Shylesh Kumar Mohan <[email protected]>
  • Loading branch information
shylesh committed Oct 3, 2023
1 parent a9cb624 commit 8ef7288
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4451,7 +4451,11 @@ def get_oadp_version():
for csv in csv_list:
if "oadp-operator" in csv:
# extract version string
cmd = f"oc get csv/{csv} -n {constants.ACM_HUB_BACKUP_NAMESPACE} -o wide | awk {{'print $4'}}"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
out = p.communicate()
return out[0].splitlines[1].decode()
cmd = f"oc get csv/{csv} -n {constants.ACM_HUB_BACKUP_NAMESPACE} -o wide "
awk_cmd = "awk {{'print $4'}}"
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
outbuf = subprocess.Popen(
shlex.split(awk_cmd), stdin=p.stdout, stdout=subprocess.PIPE
)
out = outbuf.communicate()
return out[0].splitlines()[1].decode()

0 comments on commit 8ef7288

Please sign in to comment.