From 2468a95949c6a67801ea5bc9b4b515e8800ba9b2 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Mon, 30 Jan 2017 17:39:16 +0100
Subject: [PATCH] Generate zone files for domains with only mailhost in them

---
 src/hostinfo/named.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/hostinfo/named.py b/src/hostinfo/named.py
index a83ef2e..34cf055 100755
--- a/src/hostinfo/named.py
+++ b/src/hostinfo/named.py
@@ -232,6 +232,12 @@ def generate_forward(tree, hosts):
     for c in tree._subnet_._cname_:
         result[c.domain[1]].add_host(c.alias[0], c.ttl[0], 'CNAME', c.name[0])
         pass
+    # Add mx hosts
+    for m in tree._host_._interface_._mailhost_:
+        # Force generation of domain file even if only mailhost present
+        result[m.domain[0]]
+        pass
+
     # Add numbered hosts
     def add_host(domain, name, ttl, address):
         if address.version == 4:
-- 
GitLab