summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2017-01-11 10:10:27 -0800
committerTim Bielawa <tbielawa@redhat.com>2017-01-11 10:12:19 -0800
commit699e895abcdb18ec81c977fb5143eef6794cd807 (patch)
treeeb74a38ce81d754d0939f7671c79eeb817e5c031 /roles
parentc9919242e76c03ea25993d8ee14c2ac64014077c (diff)
downloadopenshift-699e895abcdb18ec81c977fb5143eef6794cd807.tar.gz
openshift-699e895abcdb18ec81c977fb5143eef6794cd807.tar.bz2
openshift-699e895abcdb18ec81c977fb5143eef6794cd807.tar.xz
openshift-699e895abcdb18ec81c977fb5143eef6794cd807.zip
Add a fact to select --evacuate or --drain based on your OCP version
Closes #3070
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py15
-rw-r--r--roles/openshift_node/README.md2
2 files changed, 17 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 6baf9d016..10e30f1c4 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -867,6 +867,20 @@ def set_deployment_facts_if_unset(facts):
return facts
+def set_evacuate_or_drain_option(facts):
+ """OCP before 1.5/3.5 used '--evacuate'. As of 1.5/3.5 OCP uses
+'--drain'. Let's make that a fact for easy reference later.
+ """
+ if facts['common']['version_gte_3_5_or_1_5']:
+ # New-style
+ facts['common']['evacuate_or_drain'] = '--drain'
+ else:
+ # Old-style
+ facts['common']['evacuate_or_drain'] = '--evacuate'
+
+ return facts
+
+
def set_version_facts_if_unset(facts):
""" Set version facts. This currently includes common.version and
common.version_gte_3_1_or_1_1.
@@ -1898,6 +1912,7 @@ class OpenShiftFacts(object):
facts = build_controller_args(facts)
facts = build_api_server_args(facts)
facts = set_version_facts_if_unset(facts)
+ facts = set_evacuate_or_drain_option(facts)
facts = set_dnsmasq_facts_if_unset(facts)
facts = set_manageiq_facts_if_unset(facts)
facts = set_aggregate_facts(facts)
diff --git a/roles/openshift_node/README.md b/roles/openshift_node/README.md
index 616f44c1d..b69b60c1d 100644
--- a/roles/openshift_node/README.md
+++ b/roles/openshift_node/README.md
@@ -47,6 +47,8 @@ oadm manage-node --drain ${NODE}
oadm manage-node --schedulable=true ${NODE}
````
+> If you are using version less than 1.5/3.5 you must replace `--drain` with `--evacuate`.
+
TODO