Update launch-node's dns.py to work with openstacksdk

Shade no longer uses novaclient. shade also strips links dicts from the
resources it returns. shade also now depends on openstacksdk, which does
not strip links dicts.

Change-Id: Ifb6a8280e548cb55932cae4a2bba8e1fa5b34c3c
This commit is contained in:
David Moreau Simard 2018-03-22 15:26:35 -04:00 committed by Monty Taylor
parent 39259a4858
commit 213975b930
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 9 additions and 6 deletions

View File

@ -18,7 +18,7 @@ virtualenv::
virtualenv -p python2 ~/launch-env/
. ~/launch-env/bin/activate
pip install ansible==2.1.1.0 shade==1.12.1
pip install ansible==2.1.1.0 shade
To launch a node in the OpenStack CI account (production servers)::

View File

@ -33,8 +33,9 @@ def print_dns(cloud, server):
ip4 = server.public_v4
ip6 = server.public_v6
for raw_server in cloud.nova_client.servers.list():
if raw_server.id == server.id:
# Get the server object from the sdk layer so that we can pull the
# href data out of the links dict.
raw_server = cloud.compute.get_server(server.id)
href = get_href(raw_server)
print
@ -77,8 +78,10 @@ def main():
parser.add_argument("name", help="server name")
options = parser.parse_args()
import shade
cloud = shade.openstack_cloud()
import openstack
cloud = openstack.connect()
# Get the server using the shade layer so that we have server.public_v4
# and server.public_v6
server = cloud.get_server(options.name)
print_dns(cloud, server)