diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java index 4390646..bb3f50d 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -41,7 +41,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { createSudouersProc(hive), createProftpdConfProc(hive), createMakePacDirectoryStructure(unixUser), - createIfUp(pacName), + createIfUp(pac), createHttpdVirtualProc(hive), createAccountingRulesProc()); } else { @@ -69,7 +69,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { Hive hive = pac.getHive(); WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName())); waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor( - createIfDown(pac.getName()), + createIfDown(pac), createEtcHostsProc(hive), createNetworkInterfacesProc(hive), createSudouersProc(hive), @@ -113,10 +113,11 @@ public class PacProcessorFactory implements EntityProcessorFactory { return new VelocityProcessor("/de/hsadmin/mods/pac/hosts.vm", hive, "/etc/hosts", true); } - private Processor createNetworkInterfacesProc(Hive hive) throws ProcessorException { - VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true); - VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true); - return new CompoundProcessor(interfacesProc, pacIPv4Proc); + private Processor createNetworkInterfacesProc(final Hive hive) throws ProcessorException { +// VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true); + final VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true); + return pacIPv4Proc; +// return new CompoundProcessor(interfacesProc, pacIPv4Proc); } private Processor createIPTablesProc() { @@ -183,12 +184,21 @@ public class PacProcessorFactory implements EntityProcessorFactory { ); } - private Processor createIfUp(String pacName) { - return new ShellProcessor("ifup eth0:" + pacName); + private Processor createIfUp(final Pac pac) { +// return new ShellProcessor("ifup eth0:" + pacName); + return new ShellProcessor("ip addr add " + + pac.getCurINetAddr().getInetAddr() + + "/32 dev eth0 label eth0:" + + pac.getName() + ); } - private Processor createIfDown(String pacName) { - return new ShellProcessor("ifdown eth0:" + pacName); + private Processor createIfDown(final Pac pac) { +// return new ShellProcessor("ifdown eth0:" + pacName); + return new ShellProcessor("ip addr del " + + pac.getCurINetAddr().getInetAddr() + + "/32 dev eth0" + ); } private UnixUser getPacAdminUser(Pac pac) throws ProcessorException { diff --git a/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm b/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm index a2fb8cf..ef28820 100644 --- a/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm +++ b/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm @@ -2,11 +2,9 @@ # This file is managed by HSAdmin. # Do not edit manually. Changes will be overwritten. # - +# #foreach( $pac in ${hive.pacs} ) #if( !${pac.managedServer} ) eth0:${pac.name}:${pac.curINetAddr.inetAddr}/32 #end -#end - - +#end \ No newline at end of file