route53-wildcard.py 文件源码

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

项目:paas-tools 作者: imperodesign 项目源码 文件源码
def create_cname(args):
    conn = boto.route53.connect_to_region(args['--region'])
    zone = conn.get_zone(args['<zone>'])
    name = args['<name>']
    status = zone.add_cname(name, args['<value>'], ttl=args['--ttl'])
    print("waiting for record to sync: {}".format(status))
    while status.update() != "INSYNC":
        time.sleep(2)
    print(status)
    print('waiting for wildcard domain to become available...', end='')
    # AWS docs say it can take up to 30 minutes for route53 changes to happen, although
    # it seems to be almost immediate.
    for i in xrange(120):
        try:
            random_hostname = str(uuid.uuid4())[:8]
            if socket.gethostbyname("{}.{}".format(random_hostname, name)):
                print('ok')
                break
        except socket.gaierror:
            time.sleep(15)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号