boto-route53 icon indicating copy to clipboard operation
boto-route53 copied to clipboard

include zone.change_info if available

Open turnkeylinux opened this issue 14 years ago • 0 comments

Nice work Mitchell! It really is a cleaner interface than what boto currently has. I've attached a patch you might want to include (unfortunately I can't upload my branch at the moment for a pull request).

commit b03061d647d70d3e22535f638c479a970d33ec1a
Author: Alon Swartz <[email protected]>
Date:   Wed Apr 27 12:26:28 2011 +0300

    route53: include zone.change_info if available

    rational:
        - the code returns the HostedZone, but we need the ChangeInfo ID for a
          subsequent call to verify the change status is INSYNC.

    side note:
        - mitchells readme example code explains that when creating a new zone,
          the return value is of ChangeInfo, but its not.
        - the get_object call could be changed from HostedZone to ChangeInfo, but
          then that means the caller would need to store the domain_name, perform
          a full query of all domain_names to parse to get the relevant info (id
          nameservers, etc.)

diff --git a/boto2/route53/hosted_zone.py b/boto2/route53/hosted_zone.py
index 30892e2..6667e48 100644
--- a/boto2/route53/hosted_zone.py
+++ b/boto2/route53/hosted_zone.py
@@ -14,6 +14,7 @@ class HostedZone(object):
         self.caller_reference = caller_reference
         self.comment = comment
         self.name_servers = []
+        self.change_info = None

     def __repr__(self):
         return 'HostedZone:%s' % self.id
@@ -43,6 +44,8 @@ class HostedZone(object):
             self.comment = value
         elif name == 'NameServer':
             self.name_servers.append(value)
+        elif name == 'ChangeInfo':
+            self.change_info = ChangeInfo(self.connection)
         else:
             setattr(self, name, value)

turnkeylinux avatar Apr 27 '11 11:04 turnkeylinux