configure_security_groups.py 文件源码

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

项目:bosh-azure-template 作者: cf-platform-eng 项目源码 文件源码
def get_ha_proxy_address(ctx):
    client = index_client.IndexClient(ctx.meta['index-file'])
    manifest = client.find_by_release('elastic-runtime')
    settings = ctx.meta['settings']

    username = settings["username"]
    manifest_path = os.path.join("/home", username, 'manifests', manifest['file'])

    with open(manifest_path, 'r') as stream:
        content = stream.read()

        try:
            doc = yaml.load(content)
        except yaml.YAMLError as exc:
            print(exc)
            return None

    job = filter(lambda job: job['name'] == 'haproxy', doc['jobs'])[0]
    default_net = filter(lambda net: net['name'] == 'default', job['networks'])[0]
    return default_net['static_ips'][0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号