Browse Source

Update version checks to tolerate 3.7

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
Steve Kuznetsov 7 years ago
parent
commit
553a9ce216

+ 7 - 1
roles/openshift_facts/library/openshift_facts.py

@@ -915,6 +915,7 @@ def set_version_facts_if_unset(facts):
                 version_gte_3_4_or_1_4 = version >= LooseVersion('1.4')
                 version_gte_3_5_or_1_5 = version >= LooseVersion('1.5')
                 version_gte_3_6 = version >= LooseVersion('3.6')
+                version_gte_3_7 = version >= LooseVersion('3.7')
             else:
                 version_gte_3_1_or_1_1 = version >= LooseVersion('3.0.2.905')
                 version_gte_3_1_1_or_1_1_1 = version >= LooseVersion('3.1.1')
@@ -923,6 +924,7 @@ def set_version_facts_if_unset(facts):
                 version_gte_3_4_or_1_4 = version >= LooseVersion('3.4')
                 version_gte_3_5_or_1_5 = version >= LooseVersion('3.5')
                 version_gte_3_6 = version >= LooseVersion('3.6')
+                version_gte_3_7 = version >= LooseVersion('3.7')
         else:
             # 'Latest' version is set to True, 'Next' versions set to False
             version_gte_3_1_or_1_1 = True
@@ -932,6 +934,7 @@ def set_version_facts_if_unset(facts):
             version_gte_3_4_or_1_4 = True
             version_gte_3_5_or_1_5 = True
             version_gte_3_6 = True
+            version_gte_3_7 = True
         facts['common']['version_gte_3_1_or_1_1'] = version_gte_3_1_or_1_1
         facts['common']['version_gte_3_1_1_or_1_1_1'] = version_gte_3_1_1_or_1_1_1
         facts['common']['version_gte_3_2_or_1_2'] = version_gte_3_2_or_1_2
@@ -939,8 +942,11 @@ def set_version_facts_if_unset(facts):
         facts['common']['version_gte_3_4_or_1_4'] = version_gte_3_4_or_1_4
         facts['common']['version_gte_3_5_or_1_5'] = version_gte_3_5_or_1_5
         facts['common']['version_gte_3_6'] = version_gte_3_6
+        facts['common']['version_gte_3_7'] = version_gte_3_7
 
-        if version_gte_3_6:
+        if version_gte_3_7:
+            examples_content_version = 'v3.7'
+        elif version_gte_3_6:
             examples_content_version = 'v3.6'
         elif version_gte_3_5_or_1_5:
             examples_content_version = 'v1.5'

+ 4 - 4
roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py

@@ -40,10 +40,10 @@ class LookupModule(LookupBase):
                 # pylint: disable=line-too-long
                 raise AnsibleError("Either OpenShift needs to be installed or openshift_release needs to be specified")
         if deployment_type == 'origin':
-            if short_version not in ['1.1', '1.2', '1.3', '1.4', '1.5', '3.6', 'latest']:
+            if short_version not in ['1.1', '1.2', '1.3', '1.4', '1.5', '3.6', '3.7', 'latest']:
                 raise AnsibleError("Unknown short_version %s" % short_version)
         elif deployment_type == 'openshift-enterprise':
-            if short_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6', 'latest']:
+            if short_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6', '3.7', 'latest']:
                 raise AnsibleError("Unknown short_version %s" % short_version)
         else:
             raise AnsibleError("Unknown deployment_type %s" % deployment_type)
@@ -53,7 +53,7 @@ class LookupModule(LookupBase):
             short_version = re.sub('^1.', '3.', short_version)
 
         if short_version == 'latest':
-            short_version = '3.6'
+            short_version = '3.7'
 
         # Predicates ordered according to OpenShift Origin source:
         # origin/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
@@ -101,7 +101,7 @@ class LookupModule(LookupBase):
                 {'name': 'MatchInterPodAffinity'}
             ])
 
-        if short_version in ['3.5', '3.6']:
+        if short_version in ['3.5', '3.6', '3.7']:
             predicates.extend([
                 {'name': 'NoVolumeZoneConflict'},
                 {'name': 'MaxEBSVolumeCount'},

+ 4 - 4
roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py

@@ -41,10 +41,10 @@ class LookupModule(LookupBase):
                 raise AnsibleError("Either OpenShift needs to be installed or openshift_release needs to be specified")
 
         if deployment_type == 'origin':
-            if short_version not in ['1.1', '1.2', '1.3', '1.4', '1.5', '3.6', 'latest']:
+            if short_version not in ['1.1', '1.2', '1.3', '1.4', '1.5', '3.6', '3.7', 'latest']:
                 raise AnsibleError("Unknown short_version %s" % short_version)
         elif deployment_type == 'openshift-enterprise':
-            if short_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6', 'latest']:
+            if short_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6', '3.7', 'latest']:
                 raise AnsibleError("Unknown short_version %s" % short_version)
         else:
             raise AnsibleError("Unknown deployment_type %s" % deployment_type)
@@ -54,7 +54,7 @@ class LookupModule(LookupBase):
             short_version = re.sub('^1.', '3.', short_version)
 
         if short_version == 'latest':
-            short_version = '3.6'
+            short_version = '3.7'
 
         if short_version == '3.1':
             priorities.extend([
@@ -91,7 +91,7 @@ class LookupModule(LookupBase):
                 {'name': 'InterPodAffinityPriority', 'weight': 1}
             ])
 
-        if short_version in ['3.5', '3.6']:
+        if short_version in ['3.5', '3.6', '3.7']:
             priorities.extend([
                 {'name': 'SelectorSpreadPriority', 'weight': 1},
                 {'name': 'InterPodAffinityPriority', 'weight': 1},

+ 4 - 0
roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py

@@ -44,6 +44,8 @@ DEFAULT_PRIORITIES_1_5 = [
 
 DEFAULT_PRIORITIES_3_6 = DEFAULT_PRIORITIES_1_5
 
+DEFAULT_PRIORITIES_3_7 = DEFAULT_PRIORITIES_3_6
+
 ZONE_PRIORITY = {
     'name': 'Zone',
     'argument': {
@@ -67,6 +69,8 @@ TEST_VARS = [
     ('3.5', 'openshift-enterprise', DEFAULT_PRIORITIES_1_5),
     ('3.6', 'origin', DEFAULT_PRIORITIES_3_6),
     ('3.6', 'openshift-enterprise', DEFAULT_PRIORITIES_3_6),
+    ('3.7', 'origin', DEFAULT_PRIORITIES_3_7),
+    ('3.7', 'openshift-enterprise', DEFAULT_PRIORITIES_3_7),
 ]