summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@afrolegs.com>2017-03-07 13:43:16 -0500
committerGitHub <noreply@github.com>2017-03-07 13:43:16 -0500
commited103af9a9fb6f99f4c2f4d040649698d67eb6b0 (patch)
tree3d45438c56952aea3a06c07fe2efc20dc2020bac /roles/openshift_facts
parent58f7c7592de0c43ef02b9fb4ff5a10d7e2976ea3 (diff)
parent0aa1803603fb998c92c85577b216790b0e1ff7d1 (diff)
downloadopenshift-ed103af9a9fb6f99f4c2f4d040649698d67eb6b0.tar.gz
openshift-ed103af9a9fb6f99f4c2f4d040649698d67eb6b0.tar.bz2
openshift-ed103af9a9fb6f99f4c2f4d040649698d67eb6b0.tar.xz
openshift-ed103af9a9fb6f99f4c2f4d040649698d67eb6b0.zip
Merge pull request #3565 from EricMountain-1A/fix_upstream_docker_registries_order
Preserve order of Docker registries
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 75b55c369..8ea900e21 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -2319,14 +2319,19 @@ class OpenShiftFacts(object):
protected_facts_to_overwrite)
if 'docker' in new_local_facts:
- # remove duplicate and empty strings from registry lists
+ # remove duplicate and empty strings from registry lists, preserving order
for cat in ['additional', 'blocked', 'insecure']:
key = '{0}_registries'.format(cat)
if key in new_local_facts['docker']:
val = new_local_facts['docker'][key]
if isinstance(val, string_types):
val = [x.strip() for x in val.split(',')]
- new_local_facts['docker'][key] = list(set(val) - set(['']))
+ seen = set()
+ new_local_facts['docker'][key] = list()
+ for registry in val:
+ if registry not in seen and registry != '':
+ seen.add(registry)
+ new_local_facts['docker'][key].append(registry)
# Convert legacy log_options comma sep string to a list if present:
if 'log_options' in new_local_facts['docker'] and \
isinstance(new_local_facts['docker']['log_options'], string_types):