diff options
author | OpenShift Bot <eparis+openshiftbot@redhat.com> | 2017-08-02 06:16:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 06:16:32 -0400 |
commit | b22ebdcce1c5ffea48cf95695d654d112da5c812 (patch) | |
tree | 3122d150cc46d2b28e3c9908b04bf2c714822412 /roles/openshift_health_checker/openshift_checks/__init__.py | |
parent | beb5deaedb105acd113807597858069a38553952 (diff) | |
parent | 04154a21237f9da6ee64bf57097d125b85b99a5f (diff) | |
download | openshift-b22ebdcce1c5ffea48cf95695d654d112da5c812.tar.gz openshift-b22ebdcce1c5ffea48cf95695d654d112da5c812.tar.bz2 openshift-b22ebdcce1c5ffea48cf95695d654d112da5c812.tar.xz openshift-b22ebdcce1c5ffea48cf95695d654d112da5c812.zip |
Merge pull request #4592 from juanvallejo/jvallejo/verify-fluentd-logging-config
Merged by openshift-bot
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/__init__.py')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/__init__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/__init__.py b/roles/openshift_health_checker/openshift_checks/__init__.py index 40a28cde5..85cbc6224 100644 --- a/roles/openshift_health_checker/openshift_checks/__init__.py +++ b/roles/openshift_health_checker/openshift_checks/__init__.py @@ -105,6 +105,29 @@ class OpenShiftCheck(object): raise OpenShiftCheckException("'{}' is undefined".format(".".join(map(str, keys)))) return value + @staticmethod + def get_major_minor_version(openshift_image_tag): + """Parse and return the deployed version of OpenShift as a tuple.""" + if openshift_image_tag and openshift_image_tag[0] == 'v': + openshift_image_tag = openshift_image_tag[1:] + + # map major release versions across releases + # to a common major version + openshift_major_release_version = { + "1": "3", + } + + components = openshift_image_tag.split(".") + if not components or len(components) < 2: + msg = "An invalid version of OpenShift was found for this host: {}" + raise OpenShiftCheckException(msg.format(openshift_image_tag)) + + if components[0] in openshift_major_release_version: + components[0] = openshift_major_release_version[components[0]] + + components = tuple(int(x) for x in components[:2]) + return components + LOADER_EXCLUDES = ( "__init__.py", |