From 213975b930fedb44fb436b53e5c0e69a83966ab5 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Thu, 22 Mar 2018 15:26:35 -0400 Subject: [PATCH] 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 --- launch/README | 2 +- launch/dns.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/launch/README b/launch/README index 8e674ee206..fb346255d8 100644 --- a/launch/README +++ b/launch/README @@ -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):: diff --git a/launch/dns.py b/launch/dns.py index abe0a45c22..f8255e1542 100755 --- a/launch/dns.py +++ b/launch/dns.py @@ -33,9 +33,10 @@ 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: - href = get_href(raw_server) + # 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 print "Run the following commands to set up DNS:" @@ -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)