az_acs.py 文件源码

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

项目:ansible-container-demo 作者: linuxpolska 项目源码 文件源码
def print_list():
    cfg = get_config()
    meta = {'hostvars': {}}
    for alias, attributes in cfg.items():
        tmp_dict = {}
        for az_opt, ans_opt in _az_to_ansible:
            if az_opt in attributes:
                # If the attribute is a list, just take the first element.
                # Private key is returned in a list for some reason.
                attr = attributes[az_opt]
                if isinstance(attr, MutableSequence):
                    attr = attr[0]
                tmp_dict[ans_opt] = attr
        if tmp_dict:
            meta['hostvars'][alias] = tmp_dict

    print(json.dumps({_key: list(set(meta['hostvars'].keys())), '_meta': meta}))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号