From f0ad6c5a1fd3f93d776097619231d1cd4860e520 Mon Sep 17 00:00:00 2001 From: Juho-Mikko Pellinen Date: Mon, 6 Jul 2015 13:02:24 +0300 Subject: [PATCH] Fix hosted_zone_id after rebase. --- cloud/amazon/route53.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloud/amazon/route53.py b/cloud/amazon/route53.py index 8dd781ffdf2..a981c6ef2be 100644 --- a/cloud/amazon/route53.py +++ b/cloud/amazon/route53.py @@ -250,13 +250,13 @@ try: except ImportError: HAS_BOTO = False -def get_zone_by_name(conn, module, zone_name, want_private): - """Finds a zone by name""" +def get_zone_by_name(conn, module, zone_name, want_private, zone_id): + """Finds a zone by name or zone_id""" for zone in conn.get_zones(): # only save this zone id if the private status of the zone matches # the private_zone_in boolean specified in the params private_zone = module.boolean(zone.config.get('PrivateZone', False)) - if private_zone == want_private and zone.name == zone_name: + if private_zone == want_private and ((zone.name == zone_name and zone_id == None) or zone.id.replace('/hostedzone/', '') == zone_id): return zone return None @@ -280,7 +280,7 @@ def main(): argument_spec.update(dict( command = dict(choices=['get', 'create', 'delete'], required=True), zone = dict(required=True), - hosted_zone_id = dict(required=False), + hosted_zone_id = dict(required=False, default=None), record = dict(required=True), ttl = dict(required=False, type='int', default=3600), type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS'], required=True), @@ -351,7 +351,7 @@ def main(): module.fail_json(msg = e.error_message) # Find the named zone ID - zone = get_zone_by_name(conn, module, zone_in, private_zone_in) + zone = get_zone_by_name(conn, module, zone_in, private_zone_in, hosted_zone_id_in) # Verify that the requested zone is already defined in Route53 if zone is None: