diff options
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | octodns-custom-providers/provider/zonefile.py | 8 | ||||
-rwxr-xr-x | setup.py | 2 |
3 files changed, 11 insertions, 1 deletions
@@ -7,6 +7,8 @@ Custom [OctoDNS](https://github.com/octodns/octodns) Providers/Sources I wrote f OctoDNS only provides a ZoneFile source. This Provider can create a BIND compatible ZoneFile. It can NOT be used as a source. Use the builtin OctoDNS ZoneFile source instead. +soa.serial can be used with `env/` keyword to use environment variable as Serialnumber + Example ``` 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): @@ -3,7 +3,7 @@ import setuptools setup( name='octodns-custom-providers', - version='0.3.0', + version='0.3.1', author="Jonas Gunz", author_mail="himself@jonasgunz.de", description="Custom sources for OctoDNS", |