From 9e4f6062a70db8a32ed351427cbfbf1651c1e795 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Mon, 29 Jul 2019 17:56:59 +0200 Subject: [PATCH] fix list of all dns zones --- .../mods/dom/DomainProcessorFactory.java | 17 +++++++++++++++-- .../src/de/hsadmin/mods/dom/named-hsh-conf.vm | 3 +++ .../de/hsadmin/pillar/JsonPillarServlet.java | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java index d6e97df..dfdcbe9 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java @@ -88,9 +88,22 @@ public class DomainProcessorFactory implements EntityProcessorFactory { } private Processor createDNSServerConfigProcessor(EntityManager em) { - final Query query = em.createQuery("SELECT d FROM Domains d"); final HashMap templateVars = new HashMap(); - templateVars.put("domains", query.getResultList()); + final Query pacsQuery = em.createQuery("SELECT p FROM Pacs p WHERE p.basepac.name = 'PAC/WEB'"); + final List pacsList = pacsQuery.getResultList(); + templateVars.put("pacs", pacsList); + final Query domsQuery = em.createQuery("SELECT d FROM Domains d"); + final List domsList = domsQuery.getResultList(); + final List filteredDomsList = new ArrayList(); + for (final Object listElement : domsList) { + if (listElement instanceof Domain) { + final Domain d = (Domain) listElement; + if (!d.isPacDomain()) { + filteredDomsList.add(d); + } + } + } + templateVars.put("domains", filteredDomsList); return new CompoundProcessor( new VelocityProcessor("/de/hsadmin/mods/dom/named-hsh-conf.vm", templateVars, "/etc/bind/named-hsh.conf.tmp", true), diff --git a/hsarback/src/de/hsadmin/mods/dom/named-hsh-conf.vm b/hsarback/src/de/hsadmin/mods/dom/named-hsh-conf.vm index 92322e8..a9b8ea3 100644 --- a/hsarback/src/de/hsadmin/mods/dom/named-hsh-conf.vm +++ b/hsarback/src/de/hsadmin/mods/dom/named-hsh-conf.vm @@ -3,6 +3,9 @@ // Do not edit manually. Changes will be overwritten. // +#foreach( $pac in ${pacs} ) +zone "${pac.name}.hostsharing.net" { type slave; file "sec.${pac.name}.hostsharing.net"; masters { ${pac.hive.inetAddr.inet4Addr}; }; }; +#end #foreach( $domain in ${domains} ) zone "${domain.name}" { type slave; file "sec.${domain.name}"; masters { ${domain.user.pac.hive.inetAddr.inet4Addr}; }; }; #end diff --git a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java index 5bfbc58..a1c8258 100644 --- a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java +++ b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java @@ -20,6 +20,7 @@ import de.hsadmin.core.model.Transaction; import de.hsadmin.core.qserv.ProcessorException; import de.hsadmin.core.util.IPv6Trick; import de.hsadmin.mods.dom.Domain; +import de.hsadmin.mods.dom.DomainOption; import de.hsadmin.mods.pac.Hive; import de.hsadmin.mods.pac.INetAddress; import de.hsadmin.mods.pac.Pac; @@ -113,6 +114,7 @@ public class JsonPillarServlet extends HttpServlet { final Domain dom = (Domain) result; final String domName = dom.getName(); dnsZones.add(domName); +// final Set domainoptions = dom.getDomainoptions(); if (firstLoop) { firstLoop = false; writer.println(" {");