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 2016/03/01 16:26:41 UTC
[1/5] libcloud git commit: Register priority for MX records
Repository: libcloud
Updated Branches:
refs/heads/trunk 9fe309ddd -> 2b24d774f
Register priority for MX records
As is, this fails to split out the priority value from the raw record value, resulting in a key error for missing priority when trying to export in BIND format. This is the quick hack I did to get the function to return a more useful Record.
Closes #718
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f29960fb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f29960fb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f29960fb
Branch: refs/heads/trunk
Commit: f29960fbe01f6c3204eea84e62bfb51c7c9fb4c7
Parents: 9fe309d
Author: Ryan Lee <ry...@zepheira.com>
Authored: Mon Feb 29 15:16:45 2016 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:02 2016 +0100
----------------------------------------------------------------------
libcloud/dns/drivers/gandi.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f29960fb/libcloud/dns/drivers/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/gandi.py b/libcloud/dns/drivers/gandi.py
index 0e46d38..a7ca186 100644
--- a/libcloud/dns/drivers/gandi.py
+++ b/libcloud/dns/drivers/gandi.py
@@ -147,16 +147,20 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
return res.object
def _to_record(self, record, zone):
+ extras = {'ttl': record['ttl']}
+ value = record['value']
+ if record['type'] == 'MX':
+ extras['priority'] = record['value'].split(' ')[0]
+ value = record['value'].split(' ')[1]
return Record(
id='%s:%s' % (record['type'], record['name']),
name=record['name'],
type=self._string_to_record_type(record['type']),
- data=record['value'],
+ data=value,
zone=zone,
driver=self,
ttl=record['ttl'],
- extra={'ttl': record['ttl']}
- )
+ extra=extras
def _to_records(self, records, zone):
retval = []
[5/5] libcloud git commit: Update changelog.
Posted by to...@apache.org.
Update changelog.
Closes #718
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2b24d774
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2b24d774
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2b24d774
Branch: refs/heads/trunk
Commit: 2b24d774f0f85105622b5f6b4285bf6c0151c686
Parents: bd3c1f0
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Mar 1 16:00:42 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:28 2016 +0100
----------------------------------------------------------------------
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b24d774/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 6905ccb..866613d 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -104,6 +104,10 @@ DNS
connection class is correctly set to the hostname.
[Tomaz Muraus]
+- Fix handling of ``MX`` records in the Gandi driver.
+ (GITHUB-718)
+ [Ryan Lee]
+
Backup
~~~~~~
[2/5] libcloud git commit: Fix syntax error, add a comment.
Posted by to...@apache.org.
Fix syntax error, add a comment.
Closes #718
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1d0b2eee
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1d0b2eee
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1d0b2eee
Branch: refs/heads/trunk
Commit: 1d0b2eeeb710ecbf3f65a34df3c38170a78a5216
Parents: f29960f
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Mar 1 15:55:15 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:14 2016 +0100
----------------------------------------------------------------------
libcloud/dns/drivers/gandi.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1d0b2eee/libcloud/dns/drivers/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/gandi.py b/libcloud/dns/drivers/gandi.py
index a7ca186..39a21e3 100644
--- a/libcloud/dns/drivers/gandi.py
+++ b/libcloud/dns/drivers/gandi.py
@@ -147,10 +147,13 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
return res.object
def _to_record(self, record, zone):
- extras = {'ttl': record['ttl']}
+ extra = {'ttl': record['ttl']}
value = record['value']
if record['type'] == 'MX':
- extras['priority'] = record['value'].split(' ')[0]
+ # Record is in the following form:
+ # <priority> <value>
+ # e.g. 15 aspmx.l.google.com
+ extra['priority'] = record['value'].split(' ')[0]
value = record['value'].split(' ')[1]
return Record(
id='%s:%s' % (record['type'], record['name']),
@@ -160,7 +163,7 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
zone=zone,
driver=self,
ttl=record['ttl'],
- extra=extras
+ extra=extra)
def _to_records(self, records, zone):
retval = []
[3/5] libcloud git commit: Make sure "ttl" and "priority" are
integers.
Posted by to...@apache.org.
Make sure "ttl" and "priority" are integers.
Closes #718
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/29296923
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/29296923
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/29296923
Branch: refs/heads/trunk
Commit: 29296923046b4cecea200ee5aa3fb9e51f20ce77
Parents: 1d0b2ee
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Mar 1 15:59:30 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:19 2016 +0100
----------------------------------------------------------------------
libcloud/dns/drivers/gandi.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/29296923/libcloud/dns/drivers/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/gandi.py b/libcloud/dns/drivers/gandi.py
index 39a21e3..2014034 100644
--- a/libcloud/dns/drivers/gandi.py
+++ b/libcloud/dns/drivers/gandi.py
@@ -147,14 +147,15 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
return res.object
def _to_record(self, record, zone):
- extra = {'ttl': record['ttl']}
+ extra = {'ttl': int(record['ttl'])}
value = record['value']
if record['type'] == 'MX':
# Record is in the following form:
# <priority> <value>
# e.g. 15 aspmx.l.google.com
- extra['priority'] = record['value'].split(' ')[0]
- value = record['value'].split(' ')[1]
+ split = record['value'].split(' ')
+ extra['priority'] = int(split[0])
+ value = split[1]
return Record(
id='%s:%s' % (record['type'], record['name']),
name=record['name'],
[4/5] libcloud git commit: Add a test case for it.
Posted by to...@apache.org.
Add a test case for it.
Closes #718
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bd3c1f04
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bd3c1f04
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bd3c1f04
Branch: refs/heads/trunk
Commit: bd3c1f044cb59333e3c6bd20cc6bff4db1428316
Parents: 2929692
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Mar 1 15:59:44 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:24 2016 +0100
----------------------------------------------------------------------
.../test/dns/fixtures/gandi/list_records.xml | 26 ++++++++++++++++++++
libcloud/test/dns/test_gandi.py | 10 +++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bd3c1f04/libcloud/test/dns/fixtures/gandi/list_records.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/dns/fixtures/gandi/list_records.xml b/libcloud/test/dns/fixtures/gandi/list_records.xml
index e91c565..2499036 100644
--- a/libcloud/test/dns/fixtures/gandi/list_records.xml
+++ b/libcloud/test/dns/fixtures/gandi/list_records.xml
@@ -78,7 +78,33 @@
<value><string>208.111.35.173</string></value>
</member>
</struct>
+ </value>
+
+ <value>
+ <struct>
+ <member>
+ <name>id</name>
+ <value><int>47234</int></value>
+ </member>
+ <member>
+ <name>name</name>
+ <value><string></string></value>
+ </member>
+ <member>
+ <name>ttl</name>
+ <value><int>86400</int></value>
+ </member>
+ <member>
+ <name>type</name>
+ <value><string>MX</string></value>
+ </member>
+ <member>
+ <name>value</name>
+ <value><string>15 aspmx.l.google.com</string></value>
+ </member>
+ </struct>
</value>
+
</data>
</array>
</value>
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bd3c1f04/libcloud/test/dns/test_gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/test/dns/test_gandi.py b/libcloud/test/dns/test_gandi.py
index 0406077..4c3d6b6 100644
--- a/libcloud/test/dns/test_gandi.py
+++ b/libcloud/test/dns/test_gandi.py
@@ -50,7 +50,7 @@ class GandiTests(unittest.TestCase):
def test_list_records(self):
zone = self.driver.list_zones()[0]
records = self.driver.list_records(zone=zone)
- self.assertEqual(len(records), 3)
+ self.assertEqual(len(records), 4)
record = records[1]
self.assertEqual(record.name, 'www')
@@ -58,6 +58,14 @@ class GandiTests(unittest.TestCase):
self.assertEqual(record.type, RecordType.A)
self.assertEqual(record.data, '208.111.35.173')
+ record = records[3]
+ self.assertEqual(record.name, '')
+ self.assertEqual(record.id, 'MX:')
+ self.assertEqual(record.type, RecordType.MX)
+ self.assertEqual(record.data, 'aspmx.l.google.com')
+ self.assertEqual(record.extra['priority'], 15)
+ self.assertEqual(record.extra['ttl'], 86400)
+
def test_get_zone(self):
zone = self.driver.get_zone(zone_id='47234')
self.assertEqual(zone.id, '47234')