fix list of all dns zones

This commit is contained in:
Peter Hormanns 2019-07-29 17:56:59 +02:00
parent 7d1b22967d
commit 9e4f6062a7
3 changed files with 20 additions and 2 deletions

View File

@ -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<String, Object> templateVars = new HashMap<String, Object>();
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<Domain> filteredDomsList = new ArrayList<Domain>();
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),

View File

@ -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

View File

@ -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<DomainOption> domainoptions = dom.getDomainoptions();
if (firstLoop) {
firstLoop = false;
writer.println(" {");