From 530e14e32ba90197da2e9b661945dfc421a488b0 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 19 Apr 2023 10:45:11 +1000 Subject: [PATCH] launch: fix RAX rdns command-line tool I'm not sure this ever worked ... plumb the arguments through correctly. Change-Id: Ibf2e90bddb831b3671b24c48a8f19b0285978d1e --- launch/src/opendev_launch/rax_rdns.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/launch/src/opendev_launch/rax_rdns.py b/launch/src/opendev_launch/rax_rdns.py index e6e66fda8f..caa5af67cf 100644 --- a/launch/src/opendev_launch/rax_rdns.py +++ b/launch/src/opendev_launch/rax_rdns.py @@ -120,6 +120,7 @@ def rax_rdns(name, server_href, ip4, ip6, ttl, auth): r = session.post(url=rdns_url, headers=headers, json=rdns_json) logging.info("RDNS Done: %s %s" % (r.status_code, r.reason)) + logging.debug("RDNS return: %s" % r.json()) def set_rax_reverse_dns(cloud, server, ip4, ip6): @@ -145,13 +146,15 @@ def main(): parser.add_argument('--config', dest='config', default='/etc/rax-rdns-auth.conf') parser.add_argument('--ttl', dest='ttl', type=int, default=3600) - parser.add_argument('name') - parser.add_argument('server_href', required=False, - help='If server_href is not supplied then href, ' - 'and ip addresses are fetched from the cloud ' - 'using name.') - parser.add_argument('ip4') - parser.add_argument('ip6') + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument('--name') + group.add_argument('--server-href', help='server href from RAX API') + parser.add_argument('--ip4', help='Required when not using href') + parser.add_argument('--ip6', help='Required when not using href') + parser.add_argument('--cloud', default='openstackci-rax', + help='Cloud config name when not using href') + parser.add_argument('--region', default='DFW', help='Region of server when not using href') + args = parser.parse_args() logging.basicConfig(level=logging.INFO) @@ -166,7 +169,7 @@ def main(): rax_rdns(args.name, args.server_href, args.ip4, args.ip6, args.ttl, auth) else: import openstack - cloud = openstack.connect() + cloud = openstack.connect(cloud=args.cloud, region=args.region) # Get the server using the shade layer so that we have server.public_v4 # and server.public_v6 try: