launch: fix RAX rdns command-line tool

I'm not sure this ever worked ... plumb the arguments through
correctly.

Change-Id: Ibf2e90bddb831b3671b24c48a8f19b0285978d1e
This commit is contained in:
Ian Wienand 2023-04-19 10:45:11 +10:00
parent 07d453d4e6
commit 530e14e32b
No known key found for this signature in database
1 changed files with 11 additions and 8 deletions

View File

@ -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: