

def execute(self, service, shared_data):
    osutils = osutils_factory.get_os_utils()
    network_details = service.get_network_details()
    if (not network_details):
        return (plugin_base.PLUGIN_EXECUTION_DONE, False)
    network_adapters = osutils.get_network_adapters()
    network_details = _preprocess_nics(network_details, network_adapters)
    macnics = {
        
    }
    for nic in network_details:
        macnics[nic.mac] = nic
    adapter_macs = [pair[1] for pair in network_adapters]
    reboot_required = False
    configured = False
    for mac in adapter_macs:
        nic = macnics.pop(mac, None)
        if (not nic):
            LOG.warn('Missing details for adapter %s', mac)
            continue
        LOG.info('Configuring network adapter %s', mac)
        reboot = osutils.set_static_network_config(mac, nic.address, nic.netmask, nic.broadcast, nic.gateway, nic.dnsnameservers)
        reboot_required = (reboot or reboot_required)
        if (nic.address6 and nic.netmask6):
            osutils.set_static_network_config_v6(mac, nic.address6, nic.netmask6, nic.gateway6)
        configured = True
    for mac in macnics:
        LOG.warn('Details not used for adapter %s', mac)
    if (not configured):
        LOG.error('No adapters were configured')
    return (plugin_base.PLUGIN_EXECUTION_DONE, reboot_required)

dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/plugins/common/networkconfig.py NetworkConfigPlugin.execute/original