HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2019-07-29 9e4f6062a70db8a32ed351427cbfbf1651c1e795
fix list of all dns zones
3 files modified
22 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 17 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/named-hsh-conf.vm 3 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java 2 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -88,9 +88,22 @@
    }
    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),
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
hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java
@@ -20,6 +20,7 @@
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 @@
            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("    {");