do not remove pacdomain

This commit is contained in:
Peter Hormanns 2019-10-23 12:38:02 +02:00
parent 4c5e8bb7c3
commit 85ea7c6544

View File

@ -73,17 +73,19 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
final Domain dom = (Domain) entity;
final String domName = dom.getName();
final WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
createHiveDNSRemoveProcessor(domName)
createACMEBotProcessor(em, dom)
);
final Config config = Config.getInstance();
for (String queueName : config.getProperty("queues.dns").split(",")) {
mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
}
for (String queueName : config.getProperty("queues.mail").split(",")) {
mainProcessor.appendProcessor(queueName, createMailinUnsetupProcessor(em, dom), queueName + ".hostsharing.net");
}
mainProcessor.appendProcessor(dom.getHiveName(), createApacheVHostDeleteProcessor(dom), "remove apache vhost");
mainProcessor.appendProcessor(dom.getHiveName(), createACMEBotProcessor(em, dom), "remove letsencrypt config");
if (!dom.isPacDomain()) {
for (String queueName : config.getProperty("queues.dns").split(",")) {
mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
}
mainProcessor.appendProcessor(dom.getHiveName(), createHiveDNSRemoveProcessor(domName), "remove from hive dns");
}
return mainProcessor;
}
@ -351,7 +353,21 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
final String domName = dom.getName();
final int level = domName.split("\\.").length;
final String linkPrefix = Integer.toString(100 - level);
final Processor vhostDelProcessor =
if (dom.isPacDomain()) {
return
new ShellProcessor("rm -f /home/doms/" + domName +
" && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
" && rm -f /etc/apache2/sites-available/" + domName +
" && rm -f /etc/apache2/pems-enabled/" + domName + ".crt" +
" && rm -f /etc/apache2/pems-enabled/" + domName + ".key" +
" && rm -f /etc/apache2/pems-enabled/" + domName + ".chain" +
" && rm -f /etc/apache2/pems-generated/" + domName + ".crt" +
" && rm -f /etc/apache2/pems-generated/" + domName + ".key" +
" && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
" && chown -R " + dom.getUser() + ":" + dom.getUser() + " " + dom.getUser().getHomedir() + "/doms/" + domName +
" && invoke-rc.d apache2 reload >/dev/null 2>&1");
}
return
new ShellProcessor("rm -f /home/doms/" + domName +
" && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
" && rm -f /etc/apache2/sites-available/" + domName +
@ -363,7 +379,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
" && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
" && invoke-rc.d apache2 reload >/dev/null 2>&1");
return vhostDelProcessor;
}
private Processor createTriggerAcmebotProcessor(final EntityManager em, final Domain dom) {