def set_proxy_facts(facts):
    """ Set global proxy facts and promote defaults from http_proxy, https_proxy,
        no_proxy to the more specific builddefaults and builddefaults_git vars.
           1. http_proxy, https_proxy, no_proxy
           2. builddefaults_*
           3. builddefaults_git_*

        Args:
            facts(dict): existing facts
        Returns:
            facts(dict): Updated facts with missing values
    """
    if 'common' in facts:
        common = facts['common']
        if 'http_proxy' in common or 'https_proxy' in common:
            if 'generate_no_proxy_hosts' in common and \
                    common['generate_no_proxy_hosts']:
                if 'no_proxy' in common and \
                    isinstance(common['no_proxy'], basestring):
                    common['no_proxy'] = common['no_proxy'].split(",")
                else:
                    common['no_proxy'] = []
                if 'no_proxy_internal_hostnames' in common:
                    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:
        builddefaults = facts['builddefaults']
        common = facts['common']
        # Copy values from common to builddefaults
        if 'http_proxy' not in builddefaults and 'http_proxy' in common:
            builddefaults['http_proxy'] = common['http_proxy']
        if 'https_proxy' not in builddefaults and 'https_proxy' in common:
            builddefaults['https_proxy'] = common['https_proxy']
        if 'no_proxy' not in builddefaults and 'no_proxy' in common:
            builddefaults['no_proxy'] = common['no_proxy']
        if 'git_http_proxy' not in builddefaults and 'http_proxy' in builddefaults:
            builddefaults['git_http_proxy'] = builddefaults['http_proxy']
        if 'git_https_proxy' not in builddefaults and 'https_proxy' in builddefaults:
            builddefaults['git_https_proxy'] = builddefaults['https_proxy']
        # If we're actually defining a proxy config then create kube_admission_plugin_config
        # if it doesn't exist, then merge builddefaults[config] structure
        # into kube_admission_plugin_config
        if 'kube_admission_plugin_config' not in facts['master']:
            facts['master']['kube_admission_plugin_config'] = dict()
        if 'config' in builddefaults and ('http_proxy' in builddefaults or \
                'https_proxy' in builddefaults):
            facts['master']['kube_admission_plugin_config'].update(builddefaults['config'])
        facts['builddefaults'] = builddefaults

    return facts

# pylint: disable=too-many-statements
dataset/ETHPy150Open openshift/openshift-ansible/roles/openshift_facts/library/openshift_facts.py/set_proxy_facts/original