diff --git a/ocs_ci/deployment/hosted_cluster.py b/ocs_ci/deployment/hosted_cluster.py index 7777f858b042..647269d88cdf 100644 --- a/ocs_ci/deployment/hosted_cluster.py +++ b/ocs_ci/deployment/hosted_cluster.py @@ -36,8 +36,8 @@ from ocs_ci.utility import templating from ocs_ci.utility.managedservice import generate_onboarding_token from ocs_ci.utility.retry import retry -from ocs_ci.utility.utils import exec_cmd, TimeoutSampler -from ocs_ci.utility.version import get_semantic_version, get_latest_release_version +from ocs_ci.utility.utils import exec_cmd, TimeoutSampler, get_latest_release_version +from ocs_ci.utility.version import get_semantic_version logger = logging.getLogger(__name__) diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 0c1db618aafb..b3bfe90ae820 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -4739,3 +4739,21 @@ def exec_nb_db_query(query): output = output[2:-1] return output + + +def get_latest_release_version(): + """ + Get the latest release version from the release page + + Returns: + str: The latest release version + + """ + cmd = ( + "curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/release.txt | " + "awk '/^Name:/ {print $2}'" + ) + try: + return exec_cmd(cmd, shell=True).stdout.decode("utf-8").strip() + except CommandFailed: + return diff --git a/ocs_ci/utility/version.py b/ocs_ci/utility/version.py index 3f856c36f712..6eb7f33c4403 100644 --- a/ocs_ci/utility/version.py +++ b/ocs_ci/utility/version.py @@ -8,8 +8,7 @@ from ocs_ci.framework import config from ocs_ci.ocs import defaults -from ocs_ci.ocs.exceptions import WrongVersionExpression, CommandFailed -from ocs_ci.utility.utils import exec_cmd +from ocs_ci.ocs.exceptions import WrongVersionExpression def get_semantic_version(version, only_major_minor=False, ignore_pre_release=False): @@ -146,21 +145,3 @@ def compare_versions(expression): ) v1, op, v2 = m.groups() return eval(f"get_semantic_version(v1, True){op}get_semantic_version(v2, True)") - - -def get_latest_release_version(): - """ - Get the latest release version from the release page - - Returns: - str: The latest release version - - """ - cmd = ( - "curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/release.txt | " - "awk '/^Name:/ {print $2}'" - ) - try: - return exec_cmd(cmd, shell=True).stdout.decode("utf-8").strip() - except CommandFailed: - return