summaryrefslogtreecommitdiffstats
path: root/roles/lib_utils
diff options
context:
space:
mode:
authorMichael Gugino <mgugino@redhat.com>2017-12-19 16:36:47 -0500
committerMichael Gugino <mgugino@redhat.com>2017-12-21 12:28:19 -0500
commite3cf9edff6d0186b09b1a112592f283fab6857d0 (patch)
treedf4d6cc470951890afbea563a12f98fecfe16419 /roles/lib_utils
parentedde00af6a5b811468fe2a0e9bff45346103be92 (diff)
downloadopenshift-e3cf9edff6d0186b09b1a112592f283fab6857d0.tar.gz
openshift-e3cf9edff6d0186b09b1a112592f283fab6857d0.tar.bz2
openshift-e3cf9edff6d0186b09b1a112592f283fab6857d0.tar.xz
openshift-e3cf9edff6d0186b09b1a112592f283fab6857d0.zip
Remove references to deployment_type
Move openshift_deployment_type check into sanity_check action plugin. Remove compatibility for deployment_type. deployment_type has been deprecated for some time now.
Diffstat (limited to 'roles/lib_utils')
-rw-r--r--roles/lib_utils/action_plugins/sanity_checks.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/roles/lib_utils/action_plugins/sanity_checks.py b/roles/lib_utils/action_plugins/sanity_checks.py
index 2ddcf77e4..1bf332678 100644
--- a/roles/lib_utils/action_plugins/sanity_checks.py
+++ b/roles/lib_utils/action_plugins/sanity_checks.py
@@ -5,6 +5,9 @@ appropriately and no conflicting options have been provided.
from ansible.plugins.action import ActionBase
from ansible import errors
+# Valid values for openshift_deployment_type
+VALID_DEPLOYMENT_TYPES = ('origin', 'openshift-enterprise')
+
# Tuple of variable names and default values if undefined.
NET_PLUGIN_LIST = (('openshift_use_openshift_sdn', True),
('openshift_use_flannel', False),
@@ -16,7 +19,10 @@ NET_PLUGIN_LIST = (('openshift_use_openshift_sdn', True),
def to_bool(var_to_check):
"""Determine a boolean value given the multiple
ways bools can be specified in ansible."""
- yes_list = (True, 1, "True", "1", "true", "Yes", "yes")
+ # http://yaml.org/type/bool.html
+ yes_list = (True, 1, "True", "1", "true", "TRUE",
+ "Yes", "yes", "Y", "y", "YES",
+ "on", "ON", "On")
return var_to_check in yes_list
@@ -30,6 +36,15 @@ class ActionModule(ActionBase):
return None
return self._templar.template(res)
+ def check_openshift_deployment_type(self, hostvars, host):
+ """Ensure a valid openshift_deployment_type is set"""
+ openshift_deployment_type = self.template_var(hostvars, host,
+ 'openshift_deployment_type')
+ if openshift_deployment_type not in VALID_DEPLOYMENT_TYPES:
+ type_strings = ", ".join(VALID_DEPLOYMENT_TYPES)
+ msg = "openshift_deployment_type must be defined and one of {}".format(type_strings)
+ raise errors.AnsibleModuleError(msg)
+
def check_python_version(self, hostvars, host, distro):
"""Ensure python version is 3 for Fedora and python 2 for others"""
ansible_python = self.template_var(hostvars, host, 'ansible_python')
@@ -73,6 +88,7 @@ class ActionModule(ActionBase):
def run_checks(self, hostvars, host):
"""Execute the hostvars validations against host"""
distro = self.template_var(hostvars, host, 'ansible_distribution')
+ self.check_openshift_deployment_type(hostvars, host)
self.check_python_version(hostvars, host, distro)
self.network_plugin_check(hostvars, host)
self.check_hostname_vars(hostvars, host)