Remove Pac IP-Configuration from network-interfaces

This commit is contained in:
Peter Hormanns 2014-05-13 20:09:43 +02:00
parent 09223590a9
commit f1c8a05983
2 changed files with 22 additions and 14 deletions

View File

@ -41,7 +41,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
createSudouersProc(hive), createSudouersProc(hive),
createProftpdConfProc(hive), createProftpdConfProc(hive),
createMakePacDirectoryStructure(unixUser), createMakePacDirectoryStructure(unixUser),
createIfUp(pacName), createIfUp(pac),
createHttpdVirtualProc(hive), createHttpdVirtualProc(hive),
createAccountingRulesProc()); createAccountingRulesProc());
} else { } else {
@ -69,7 +69,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
Hive hive = pac.getHive(); Hive hive = pac.getHive();
WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName())); WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor( waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(
createIfDown(pac.getName()), createIfDown(pac),
createEtcHostsProc(hive), createEtcHostsProc(hive),
createNetworkInterfacesProc(hive), createNetworkInterfacesProc(hive),
createSudouersProc(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); return new VelocityProcessor("/de/hsadmin/mods/pac/hosts.vm", hive, "/etc/hosts", true);
} }
private Processor createNetworkInterfacesProc(Hive hive) throws ProcessorException { private Processor createNetworkInterfacesProc(final Hive hive) throws ProcessorException {
VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true); // 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); final VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true);
return new CompoundProcessor(interfacesProc, pacIPv4Proc); return pacIPv4Proc;
// return new CompoundProcessor(interfacesProc, pacIPv4Proc);
} }
private Processor createIPTablesProc() { private Processor createIPTablesProc() {
@ -183,12 +184,21 @@ public class PacProcessorFactory implements EntityProcessorFactory {
); );
} }
private Processor createIfUp(String pacName) { private Processor createIfUp(final Pac pac) {
return new ShellProcessor("ifup eth0:" + pacName); // 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) { private Processor createIfDown(final Pac pac) {
return new ShellProcessor("ifdown eth0:" + pacName); // 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 { private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {

View File

@ -2,11 +2,9 @@
# This file is managed by HSAdmin. # This file is managed by HSAdmin.
# Do not edit manually. Changes will be overwritten. # Do not edit manually. Changes will be overwritten.
# #
#
#foreach( $pac in ${hive.pacs} ) #foreach( $pac in ${hive.pacs} )
#if( !${pac.managedServer} ) #if( !${pac.managedServer} )
eth0:${pac.name}:${pac.curINetAddr.inetAddr}/32 eth0:${pac.name}:${pac.curINetAddr.inetAddr}/32
#end #end
#end #end