Skip to content

Commit

Permalink
import error 0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Osypenko <[email protected]>
  • Loading branch information
DanielOsypenko committed Apr 10, 2024
1 parent fa479b1 commit 7bebeee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions ocs_ci/deployment/hosted_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
18 changes: 18 additions & 0 deletions ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 1 addition & 20 deletions ocs_ci/utility/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

0 comments on commit 7bebeee

Please sign in to comment.