From 59e44b865cfa5e7d3a1f40d34f41d5b2dd285aac Mon Sep 17 00:00:00 2001 From: Maikel Poot Date: Wed, 25 Sep 2019 11:24:13 +0200 Subject: [PATCH] Added detection for edge case that could happen with existing records where the value is '@' TransIP allows '@' as value to alias the root record. '@' was on populate appended with the zone, which trigger an unneeded update. '@' => '@.example.com.' -> 'example.com' This fix will stop the unneeded update --- octodns/provider/transip.py | 7 ++++++- tests/test_octodns_provider_transip.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/octodns/provider/transip.py b/octodns/provider/transip.py index 8014310..adde617 100644 --- a/octodns/provider/transip.py +++ b/octodns/provider/transip.py @@ -218,7 +218,12 @@ class TransipProvider(BaseProvider): def _parse_to_fqdn(self, value): - if (value[-1] != '.'): + # TransIP allows '@' as value to alias the root record. + # this provider won't set an '@' value, but can be an existing record + if value == self.ROOT_RECORD: + value = self._currentZone.name + + if value[-1] != '.': self.log.debug('parseToFQDN: changed %s to %s', value, '{}.{}'.format(value, self._currentZone.name)) value = '{}.{}'.format(value, self._currentZone.name) diff --git a/tests/test_octodns_provider_transip.py b/tests/test_octodns_provider_transip.py index 811c1e2..d6bcaa7 100644 --- a/tests/test_octodns_provider_transip.py +++ b/tests/test_octodns_provider_transip.py @@ -188,6 +188,8 @@ N4OiVz1I3rbZGYa396lpxO6ku8yCglisL1yrSP6DdEUp66ntpKVd provider._parse_to_fqdn("www.unit.tests.")) self.assertEquals("www.sub.sub.sub.unit.tests.", provider._parse_to_fqdn("www.sub.sub.sub")) + self.assertEquals("unit.tests.", + provider._parse_to_fqdn("@")) # Happy Plan - Even if the zone has no records the zone should exist provider = TransipProvider('test', 'unittest', self.bogus_key)