093d8d7170
The v1 has officially been removed from Designate since the Queens release, and was deperecated long before that. Change-Id: Ic5b44761ff939e2b319924af87849b3a79f9cb07
34 lines
847 B
Python
34 lines
847 B
Python
from __future__ import print_function
|
|
|
|
import logging
|
|
import os
|
|
|
|
from designateclient import exceptions
|
|
from designateclient.v2 import client
|
|
|
|
from keystoneauth1.identity import generic
|
|
from keystoneauth1 import session as keystone_session
|
|
|
|
|
|
logging.basicConfig(level='DEBUG')
|
|
|
|
auth = generic.Password(
|
|
auth_url=os.environ.get('OS_AUTH_URL'),
|
|
username=os.environ.get('OS_USERNAME'),
|
|
password=os.environ.get('OS_PASSWORD'),
|
|
project_name=os.environ.get('OS_PROJECT_NAME'),
|
|
project_domain_id='default',
|
|
user_domain_id='default')
|
|
|
|
session = keystone_session.Session(auth=auth)
|
|
|
|
client = client.Client(session=session)
|
|
|
|
|
|
try:
|
|
zone = client.zones.create('i.io.', email='i@i.io')
|
|
except exceptions.RemoteError:
|
|
zone = dict([(z['name'], z) for z in client.zones.list()])['i.io.']
|
|
|
|
print(client.recordsets.list(zone['id']))
|