error in update of file virtual.conf corrected

This commit is contained in:
Peter Hormanns 2012-10-16 15:39:55 +02:00
parent c1ac39ec78
commit fbbb1f4132
2 changed files with 10 additions and 7 deletions

View File

@ -113,10 +113,10 @@ public class PacModuleImpl extends AbstractModuleImpl {
public AbstractEntity update(AbstractEntity entity) public AbstractEntity update(AbstractEntity entity)
throws HSAdminException { throws HSAdminException {
UnixUser loginUser = getTransaction().getLoginUser(); UnixUser loginUser = getTransaction().getLoginUser();
if (entity instanceof Pac) { if (!(entity instanceof Pac)) {
Pac pac = (Pac) entity;
} else {
throw new AuthorisationException(loginUser, "update", entity); throw new AuthorisationException(loginUser, "update", entity);
// } else {
// Pac pac = (Pac) entity;
} }
needsWriteAccessOn(entity, "update"); needsWriteAccessOn(entity, "update");
return super.update(entity); return super.update(entity);

View File

@ -57,14 +57,17 @@ public class PacProcessorFactory implements EntityProcessorFactory {
private Processor createHttpdVirtualProc( private Processor createHttpdVirtualProc(
String pacName, List<Map<String, String>> pacValuesList) throws ProcessorException { String pacName, List<Map<String, String>> pacValuesList) throws ProcessorException {
Processor domSetupProcessor = new CompoundProcessor( Processor domSetupProcessor = new CompoundProcessor(
new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl", new HashMap<String, String>(), pacValuesList.iterator(), "/etc/apache2/virtual.conf.tmp", "root", "root", "644", true), new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl",
new HashMap<String, String>(), pacValuesList.iterator(),
"/etc/apache2/virtual.conf.tmp", "root", "root", "644", true),
new ShellProcessor("ls /etc/apache2/pems/" + pacName + ".pem >/dev/null 2>&1 " + "&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/apache.conf.tmp" new ShellProcessor("ls /etc/apache2/pems/" + pacName + ".pem >/dev/null 2>&1 " + "&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/apache.conf.tmp"
+ " && (ls /etc/apache2/pems/" + pacName + ".chain.pem >/dev/null 2>&1" + " && (ls /etc/apache2/pems/" + pacName + ".chain.pem >/dev/null 2>&1"
+ " || sed -i '/SSLCertificateChain.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp)" + " || sed -i '/SSLCertificateChain.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp)"
+ " || sed -i '/SSLCertificate.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp"), + " || sed -i '/SSLCertificate.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp"),
new ShellProcessor("(diff -q /etc/apache2/apache.conf.tmp /etc/apache2/apache.conf" new ShellProcessor("(diff -q /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf"
+ " && rm /etc/apache2/apache.conf.tmp)" + " && rm /etc/apache2/virtual.conf.tmp )"
+ " || invoke-rc.d apache2 reload >/dev/null 2>&1")); + " || ( mv /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf "
+ " && invoke-rc.d apache2 reload >/dev/null 2>&1 ) "));
return domSetupProcessor; return domSetupProcessor;
} }