From b90d2e6e80a7080d1753caba1251505383b998f9 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Fri, 22 Apr 2016 17:01:36 -0400 Subject: Sort and de-dupe no_proxy list --- roles/openshift_facts/library/openshift_facts.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'roles/openshift_facts/library') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 4c4fd31e5..49658a2ee 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1327,6 +1327,23 @@ def get_local_facts_from_file(filename): return local_facts +def sort_unique(alist): + """ Sorts and de-dupes a list + + Args: + list: a list + Returns: + list: a sorted de-duped list + """ + + alist.sort() + out = list() + for i in alist: + if i not in out: + out.append(i) + + return out + def safe_get_bool(fact): """ Get a boolean fact safely. @@ -1363,6 +1380,7 @@ def set_proxy_facts(facts): common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(',')) common['no_proxy'].append('.' + common['dns_domain']) common['no_proxy'].append(common['hostname']) + common['no_proxy'] = sort_unique(common['no_proxy']) facts['common'] = common if 'builddefaults' in facts: -- cgit v1.2.3