
Result of running $ pyupgrade --py38-plus $(git ls-files | grep ".py$") This was inspired by Nova [1] and Octavia [2] Fixed PEP8 errors introduced by pyupgrade by running: $ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \ --in-place designate and manual updates. [1]: https://review.opendev.org/c/openstack/nova/+/896986 [2]: https://review.opendev.org/c/openstack/octavia/+/899263 Change-Id: I27d09edb7e75081379002615f4ecdb1aa007dbcf
45 lines
1008 B
Python
45 lines
1008 B
Python
import logging
|
|
import os
|
|
import uuid
|
|
|
|
from keystoneauth1.identity import generic
|
|
from keystoneauth1 import session as keystone_session
|
|
|
|
from designateclient.v2 import client
|
|
|
|
|
|
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)
|
|
|
|
# Primary Zone
|
|
primary = client.zones.create(
|
|
f'primary-{str(uuid.uuid4())}.io.',
|
|
'PRIMARY',
|
|
'root@x.com')
|
|
|
|
# Secondary Zone
|
|
slave = client.zones.create(
|
|
f'secondary-{str(uuid.uuid4())}.io.',
|
|
'SECONDARY',
|
|
masters=["127.0.1.1"])
|
|
|
|
# Try updating Masters for the Secondary
|
|
new_slave = client.zones.update(
|
|
slave['id'],
|
|
{"masters": ["10.0.0.1", "10.0.0.10"]}
|
|
)
|
|
|
|
# List all Zones
|
|
zones = client.zones.list()
|