|
@@ -1643,38 +1643,74 @@ def set_proxy_facts(facts):
|
|
|
if 'common' in facts:
|
|
|
common = facts['common']
|
|
|
|
|
|
-
|
|
|
- if 'no_proxy' not in common:
|
|
|
- common['no_proxy'] = []
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- elif 'no_proxy' in common and isinstance(common['no_proxy'], string_types):
|
|
|
-
|
|
|
-
|
|
|
- common['no_proxy'] = common['no_proxy'].split(",")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- common['no_proxy'].append('.svc')
|
|
|
- common['no_proxy'].append('.' + common['dns_domain'])
|
|
|
- common['no_proxy'].append(common['hostname'])
|
|
|
-
|
|
|
-
|
|
|
- if 'http_proxy' in common or 'https_proxy' in common:
|
|
|
-
|
|
|
- if 'generate_no_proxy_hosts' in common and safe_get_bool(common['generate_no_proxy_hosts']):
|
|
|
-
|
|
|
- if 'no_proxy_internal_hostnames' in common:
|
|
|
-
|
|
|
-
|
|
|
- common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(','))
|
|
|
-
|
|
|
- common['no_proxy'] = ','.join(sort_unique(common['no_proxy']))
|
|
|
+
|
|
|
+
|
|
|
+ proxy_params = ['no_proxy', 'https_proxy', 'http_proxy']
|
|
|
+
|
|
|
+ proxy_settings_defined = any(
|
|
|
+ [True for pp in proxy_params if pp in common]
|
|
|
+ )
|
|
|
+
|
|
|
+ if not proxy_settings_defined:
|
|
|
+ return facts
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ raw_no_proxy_list = []
|
|
|
+
|
|
|
+
|
|
|
+ svc_cluster_name = ['.svc', '.' + common['dns_domain'], common['hostname']]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ auto_hosts = common['no_proxy_internal_hostnames'].split(',')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if 'no_proxy' in common:
|
|
|
+ custom_no_proxy_hosts = common['no_proxy'].split(',')
|
|
|
+ else:
|
|
|
+ custom_no_proxy_hosts = []
|
|
|
+
|
|
|
+
|
|
|
+ if 'generate_no_proxy_hosts' in common:
|
|
|
+ generate_no_proxy_hosts = safe_get_bool(common['generate_no_proxy_hosts'])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ raw_no_proxy_list = svc_cluster_name + custom_no_proxy_hosts
|
|
|
+
|
|
|
+
|
|
|
+ if generate_no_proxy_hosts:
|
|
|
+ raw_no_proxy_list.extend(auto_hosts)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ processed_no_proxy_list = sort_unique(raw_no_proxy_list)
|
|
|
+ if processed_no_proxy_list != list():
|
|
|
+ common['no_proxy'] = ','.join(processed_no_proxy_list)
|
|
|
+ else:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ del common['no_proxy']
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return facts
|
|
|
|
|
|
|