Skip to content

Commit

Permalink
Update get odf version
Browse files Browse the repository at this point in the history
  • Loading branch information
ebattat committed Jan 13, 2025
1 parent 2944f12 commit cc6681e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions benchmark_runner/common/oc/oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,15 @@ def get_cnv_version(self):

def get_odf_version(self):
"""
This method returns odf version
:return:
This method returns the ODF version by extracting it from the csv name.
:return: ODF version as a string (e.g., '4.17.2')
"""
return self.run(f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{.items[0].spec.labels.full_version}}'")
# OCP 4.16 and below
if self.get_ocp_major_version() <= 4 and self.get_ocp_minor_version() <= 16:
command = f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{.items[0].spec.labels.full_version}}'"
else:
command = f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{range .items[*]}}{{.metadata.name}}{{\"\\n\"}}{{end}}' | grep odf-operator | sed -E 's/odf-operator.v([0-9]+\\.[0-9]+\\.[0-9]+)-rhodf/\\1/'"
return self.run(command)

def remove_lso_path(self):
"""
Expand Down

0 comments on commit cc6681e

Please sign in to comment.