pdns_zone.py 文件源码

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

项目:python-powerdns-management 作者: mrlesmithjr 项目源码 文件源码
def zone_list(module, base_url, zone=None):
    ''' Return list of existing zones '''

    list = []
    url = "{0}".format(base_url)

    response, info = fetch_url(module, url, headers=headers)
    if info['status'] != 200:
        module.fail_json(msg="failed to enumerate zones at %s: %s" % (url, info['msg']))

    content = response.read()
    data = json.loads(content)
    for z in data:
        if zone is None or fnmatch.fnmatch(z['name'], zone):
            list.append({
                'name'      : z['name'],
                'kind'      : z['kind'].lower(),
                'serial'    : z['serial'],
            })
    return list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号