inventory.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:cluster-genesis 作者: open-power-ref-design-toolkit 项目源码 文件源码
def populate_network_variables(inventory, inventory_source):
    # Add the networks from the inventory source into the host_vars
    networks = copy.deepcopy(inventory_source['networks'])
    for network in networks.values():
        # Add properties network address and the netmask
        addr = network.get('addr', None)
        if addr:
            ip = netaddr.IPNetwork(addr)
            if ip.prefixlen != 1:
                # We don't put networks in with prefix length == 1 because
                # the inventory file uses this to note that while the host
                # has an interface connected to this network, that interface
                # does not directly get an IP address and the address goes
                # on a bridge.
                network['network'] = str(ip.network)
                network['netmask'] = str(ip.netmask)
    inventory['all']['vars']['networks'] = networks
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号