From 9b6f24f271e0776f68073f72a10fb9f83d264cee Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Wed, 7 Dec 2016 15:36:42 -0500 Subject: Properly handle x.y.z formatted versions for openshift_release --- .../lookup_plugins/openshift_master_facts_default_predicates.py | 1 + .../lookup_plugins/openshift_master_facts_default_priorities.py | 1 + .../test/openshift_master_facts_default_predicates_tests.py | 5 +++++ .../test/openshift_master_facts_default_priorities_tests.py | 5 +++++ 4 files changed, 12 insertions(+) (limited to 'roles') diff --git a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py index 6aa9af74c..6255ef6eb 100644 --- a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py +++ b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py @@ -32,6 +32,7 @@ class LookupModule(LookupBase): short_version = release[1:] else: short_version = release + short_version = '.'.join(short_version.split('.')[0:2]) elif 'openshift_version' in variables: version = variables['openshift_version'] short_version = '.'.join(version.split('.')[0:2]) diff --git a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py index 7c0ba4388..7087ff03c 100644 --- a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py +++ b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py @@ -36,6 +36,7 @@ class LookupModule(LookupBase): short_version = release[1:] else: short_version = release + short_version = '.'.join(short_version.split('.')[0:2]) elif 'openshift_version' in variables: version = variables['openshift_version'] short_version = '.'.join(version.split('.')[0:2]) diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py index 0428ad465..8e4037da4 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py @@ -211,6 +211,11 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): for release, deployment_type, default_predicates in TEST_VARS: yield self.check_defaults_deployment_type_kwarg, release, deployment_type, default_predicates, regions_enabled + def test_trunc_openshift_release(self): + for release, deployment_type, default_predicates in TEST_VARS: + release = release + '.1' + yield self.check_defaults_release, release, deployment_type, default_predicates, False + @raises(AnsibleError) def test_unknown_deployment_types(self): facts = copy.deepcopy(self.default_facts) diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py index a13b546d1..5427a07a1 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py @@ -200,6 +200,11 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): for short_version, deployment_type, default_priorities in TEST_VARS: yield self.check_defaults_short_version_kwarg, short_version, deployment_type, default_priorities, zones_enabled + def test_trunc_openshift_release(self): + for release, deployment_type, default_priorities in TEST_VARS: + release = release + '.1' + yield self.check_defaults_release, release, deployment_type, default_priorities, False + @raises(AnsibleError) def test_unknown_origin_version(self): facts = copy.deepcopy(self.default_facts) -- cgit v1.2.3 From d38303c7cfc7c6d946922df696f5422bb2a32dc5 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Wed, 7 Dec 2016 16:15:16 -0500 Subject: Remove Hostname from 1.1 and 1.2 predicates --- .../lookup_plugins/openshift_master_facts_default_predicates.py | 1 - .../test/openshift_master_facts_default_predicates_tests.py | 2 -- 2 files changed, 3 deletions(-) (limited to 'roles') diff --git a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py index 6255ef6eb..4f7461827 100644 --- a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py +++ b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py @@ -65,7 +65,6 @@ class LookupModule(LookupBase): if short_version in ['1.1', '1.2']: predicates.append({'name': 'MatchNodeSelector'}) - predicates.append({'name': 'Hostname'}) if short_version != '1.1': predicates.append({'name': 'MaxEBSVolumeCount'}) diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py index 8e4037da4..c95356908 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py @@ -14,7 +14,6 @@ DEFAULT_PREDICATES_1_1 = [ {'name': 'PodFitsResources'}, {'name': 'NoDiskConflict'}, {'name': 'MatchNodeSelector'}, - {'name': 'Hostname'} ] DEFAULT_PREDICATES_1_2 = [ @@ -23,7 +22,6 @@ DEFAULT_PREDICATES_1_2 = [ {'name': 'NoDiskConflict'}, {'name': 'NoVolumeZoneConflict'}, {'name': 'MatchNodeSelector'}, - {'name': 'Hostname'}, {'name': 'MaxEBSVolumeCount'}, {'name': 'MaxGCEPDVolumeCount'} ] -- cgit v1.2.3