fix list of all dns zones
This commit is contained in:
parent
9e4f6062a7
commit
b137b45b38
@ -1,5 +1,6 @@
|
|||||||
package de.hsadmin.mods.pac;
|
package de.hsadmin.mods.pac;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,6 +51,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
createMakePacDirectoryStructure(unixUser),
|
createMakePacDirectoryStructure(unixUser),
|
||||||
createIfUp(pac),
|
createIfUp(pac),
|
||||||
createHttpdVirtualProc(hive),
|
createHttpdVirtualProc(hive),
|
||||||
|
createDNSServerConfigProcessor(em),
|
||||||
createAccountingRulesProc());
|
createAccountingRulesProc());
|
||||||
} else {
|
} else {
|
||||||
return new NullProcessor();
|
return new NullProcessor();
|
||||||
@ -279,6 +281,31 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Processor createDNSServerConfigProcessor(EntityManager em) {
|
||||||
|
final HashMap<String, Object> templateVars = new HashMap<String, Object>();
|
||||||
|
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),
|
||||||
|
new ShellProcessor(" ( diff -q /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && rm /etc/bind/named-hsh.conf.tmp ) " +
|
||||||
|
"|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && invoke-rc.d bind9 reload )")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
|
private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
|
||||||
UnixUser unixUser = null;
|
UnixUser unixUser = null;
|
||||||
Set<UnixUser> unixUserSet = pac.getUnixUser();
|
Set<UnixUser> unixUserSet = pac.getUnixUser();
|
||||||
|
Loading…
Reference in New Issue
Block a user