You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/11/22 16:46:41 UTC

[1/2] libcloud git commit: Implement update_record.

Repository: libcloud
Updated Branches:
  refs/heads/cloudflare_dns_driver 74c147035 -> 0e3e03760


Implement update_record.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/00372d0c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/00372d0c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/00372d0c

Branch: refs/heads/cloudflare_dns_driver
Commit: 00372d0ca5339bd934f32b7fa19adb711a96ecf5
Parents: 74c1470
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Nov 22 16:45:57 2015 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Nov 22 16:45:57 2015 +0100

----------------------------------------------------------------------
 libcloud/dns/drivers/cloudflare.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/00372d0c/libcloud/dns/drivers/cloudflare.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/cloudflare.py b/libcloud/dns/drivers/cloudflare.py
index 44ed160..751674a 100644
--- a/libcloud/dns/drivers/cloudflare.py
+++ b/libcloud/dns/drivers/cloudflare.py
@@ -152,6 +152,20 @@ class CloudFlareDNSDriver(DNSDriver):
         record = self._to_record(zone=zone, item=result['response']['rec']['obj'])
         return record
 
+    def update_record(self, record, name=None, type=None, data=None,
+                      extra=None):
+        extra = extra or {}
+        params = {'z': record.zone.domain, 'id': record.id}
+
+        params['name'] = name or record.name
+        params['type'] = type or record.type
+        params['content'] = data or record.data
+        params['ttl'] = extra.get('ttl', None) or record.extra['ttl']
+
+        result = self.connection.request(action='rec_edit', params=params).object
+        record = self._to_record(zone=record.zone, item=result['response']['rec']['obj'])
+        return record
+
     def delete_record(self, record):
         params = {'z': record.zone.domain, 'id': record.id}
         result = self.connection.request(action='rec_delete', params=params).object


[2/2] libcloud git commit: Improve __repr__ for Record, include zone domain instead of zone id.

Posted by to...@apache.org.
Improve __repr__ for Record, include zone domain instead of zone id.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0e3e0376
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0e3e0376
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0e3e0376

Branch: refs/heads/cloudflare_dns_driver
Commit: 0e3e0376083e54df9678bc36e155b2c7b133b286
Parents: 00372d0
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Nov 22 16:46:14 2015 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Nov 22 16:46:14 2015 +0100

----------------------------------------------------------------------
 libcloud/dns/base.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0e3e0376/libcloud/dns/base.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/base.py b/libcloud/dns/base.py
index a3a5b1c..4d74c15 100644
--- a/libcloud/dns/base.py
+++ b/libcloud/dns/base.py
@@ -138,9 +138,10 @@ class Record(object):
         return record_id
 
     def __repr__(self):
+        zone = self.zone.domain or self.zone.id
         return ('<Record: zone=%s, name=%s, type=%s, data=%s, provider=%s '
                 '...>' %
-                (self.zone.id, self.name, self.type, self.data,
+                (zone, self.name, self.type, self.data,
                  self.driver.name))