summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter_plugins/oo_filters.py5
-rw-r--r--roles/openshift_version/tasks/main.yml15
2 files changed, 15 insertions, 5 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 7510975f2..54891b066 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -891,6 +891,10 @@ class FilterModule(object):
return version
+ @staticmethod
+ def oo_startswith(input, prefix):
+ return input.startswith(prefix)
+
def filters(self):
""" returns a mapping of filters to methods """
return {
@@ -924,4 +928,5 @@ class FilterModule(object):
"oo_oc_nodes_matching_selector": self.oo_oc_nodes_matching_selector,
"oo_oc_nodes_with_label": self.oo_oc_nodes_with_label,
"oo_merge_hostvars": self.oo_merge_hostvars,
+ "oo_startswith": self.oo_startswith,
}
diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml
index 9ff13d35c..b11bf62fe 100644
--- a/roles/openshift_version/tasks/main.yml
+++ b/roles/openshift_version/tasks/main.yml
@@ -1,15 +1,15 @@
---
# Determine the openshift_version to configure if none has been specified or set previously.
+- set_fact:
+ is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
+
# Block attempts to install origin without specifying some kind of version information.
# This is because the latest tags for origin are usually alpha builds, which should not
# be used by default. Users must indicate what they want.
- fail:
- msg: "Must specify openshift_release, openshift_image_tag, or openshift_pkg_version in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)"
- when: openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_pkg_version is not defined and openshift_image_tag is not defined
-
-- set_fact:
- is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
+ msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)"
+ when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined
# Make sure we copy this to a fact if given a var:
- set_fact:
@@ -65,3 +65,8 @@
- fail: openshift_version role was unable to set openshift_pkg_version
when: openshift_pkg_version is not defined
+# We can't map an openshift_release to full rpm version like we can with containers, make sure
+# the rpm version we looked up matches the release requested and error out if not.
+- fail:
+ msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version."
+ when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool