Release 2.0.1

This commit is contained in:
Peter Hormanns 2011-08-30 13:41:19 +00:00
parent 8b2e746fa9
commit 75b244caea
3 changed files with 38 additions and 17 deletions

View File

@ -42,7 +42,8 @@ public class PacProcessorFactory implements EntityProcessorFactory {
createIPTablesProc(),
createSudouersProc(hiveValues, pacValuesList),
createProftpdConfProc(hiveValues, pacValuesList),
createMakePacDirectoryStructure(unixUser));
createMakePacDirectoryStructure(unixUser),
createIfUp(pacName));
WaitingTasksProcessor secProcessor = new WaitingTasksProcessor(priProcessor);
secProcessor.appendProcessor(pac.getHiveName(), createSendEMailProc(pacName, customerEMail, emailVars), "send email to customer");
return secProcessor;
@ -51,7 +52,8 @@ public class PacProcessorFactory implements EntityProcessorFactory {
@Override
public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity)
throws ProcessorException {
throw new ProcessorException("pac.update not implemented");
Pac pac = (Pac) entity;
return createSetQuotaProc(pac);
}
@Override
@ -61,6 +63,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
Map<String, String> hiveValues = fillHiveValues(hive);
List<Map<String, String>> pacValuesList = fillPacValuesList(hive, pac);
WaitingTasksProcessor waitingProcessor = new WaitingTasksProcessor(new CompoundProcessor(
createIfDown(pac.getName()),
createEtcHostsProc(hiveValues, pacValuesList),
createNetworkInterfacesProc(hiveValues, pacValuesList),
createSudouersProc(hiveValues, pacValuesList),
@ -130,18 +133,20 @@ public class PacProcessorFactory implements EntityProcessorFactory {
}
private Processor createMakePacDirectoryStructure(UnixUser unixUser) {
return new ShellProcessor("chmod 711 " + unixUser.getHomedir() + " && " +
"su -l " + unixUser.getName() + " -s \"/bin/bash\" -c \"mkdir -p " +
unixUser.getHomedir() + "/doms " +
unixUser.getHomedir() + "/etc " +
unixUser.getHomedir() + "/users " +
unixUser.getHomedir() + "/var " +
String homedir = unixUser.getHomedir();
String username = unixUser.getName();
return new ShellProcessor("chmod 711 " + homedir + " && " +
"su -l " + username + " -s \"/bin/bash\" -c \"mkdir -p " +
homedir + "/doms " +
homedir + "/etc " +
homedir + "/users " +
homedir + "/var " +
"\" && " +
"chown httpd " + unixUser.getHomedir() + "/doms && " +
"chmod 1550 " + unixUser.getHomedir() + "/doms && " +
"chmod 2700 " + unixUser.getHomedir() + "/etc && " +
"chmod 2750 " + unixUser.getHomedir() + "/var && " +
"chmod 2755 " + unixUser.getHomedir() + "/users"
"chown httpd " + homedir + "/doms && " +
"chmod 1550 " + homedir + "/doms && " +
"chmod 2700 " + homedir + "/etc && " +
"chmod 2750 " + homedir + "/var && " +
"chmod 2755 " + homedir + "/users"
);
}
@ -155,6 +160,14 @@ public class PacProcessorFactory implements EntityProcessorFactory {
);
}
private Processor createIfUp(String pacName) {
return new ShellProcessor("ifup eth0:" + pacName);
}
private Processor createIfDown(String pacName) {
return new ShellProcessor("ifdown eth0:" + pacName);
}
private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
UnixUser unixUser = null;
Set<UnixUser> unixUserSet = pac.getUnixUser();

View File

@ -2,9 +2,11 @@ package de.hsadmin.remote;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.mods.cust.Customer;
@ -28,10 +30,16 @@ public class PacRemote extends AbstractRemote {
resultMap.put("curinetaddr", pac.getCurINetAddr().getInetAddr());
resultMap.put("created", df.format(pac.getCreated()));
resultMap.put("basepac", pac.getBasepac().getName());
Set<PacComponent> pacComponents = pac.getPacComponents();
SortedSet<PacComponent> sortedComponents = new TreeSet<PacComponent>(new Comparator<PacComponent>() {
@Override
public int compare(PacComponent o1, PacComponent o2) {
return o2.getBaseComponent().getSorting() - o1.getBaseComponent().getSorting();
}
});
sortedComponents.addAll(pac.getPacComponents());
StringBuffer bf = new StringBuffer();
boolean empty = true;
for (PacComponent comp : pacComponents) {
for (PacComponent comp : sortedComponents) {
if (comp.getQuantity() > 0) {
if (!empty) {
bf.append("; ");

View File

@ -91,7 +91,7 @@ public class RoleTest {
@Test
public void testHostmaster() {
String user = "pe";
String user = "ad";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
Object[] params = new Object[] { user,