diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-08-29 14:08:01 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-08-29 14:08:01 +0200 |
commit | 284c2646c6898ec273feba251716bf610a31dc31 (patch) | |
tree | ec0c1696b4be1ab2d6bbe1e2abb6ccd218759119 /octodns-custom-providers | |
parent | 968ad127f39023e0cd560fa3e2f9516968043616 (diff) | |
download | octodns-custom-provider-284c2646c6898ec273feba251716bf610a31dc31.tar.gz |
soa.serial allow environment as serial number
Diffstat (limited to 'octodns-custom-providers')
-rwxr-xr-x | octodns-custom-providers/provider/zonefile.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/octodns-custom-providers/provider/zonefile.py b/octodns-custom-providers/provider/zonefile.py index f03f578..6df04e1 100755 --- a/octodns-custom-providers/provider/zonefile.py +++ b/octodns-custom-providers/provider/zonefile.py @@ -6,6 +6,8 @@ import dns.zone import dns.rdataclass import dns.rdatatype +import os + class RdataParameterException(Exception): def __init__(self, msg): super().__init__(msg) @@ -58,6 +60,12 @@ class ZoneFileProvider(BaseProvider): self.soa = soa self.soa_ttl = soa_ttl + # OctoDNS does not recursively check dicts for 'env/' keyword + # TODO Error handling + serial = self.soa['serial'] + if type(serial) == str and serial.startswith('env/'): + self.soa['serial'] = int(os.environ[ serial.split('/',1)[1] ]) + super(ZoneFileProvider, self).__init__(id) def populate(self, zone, target=False, lenient=False): |