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 c922044f5d
2 changed files with 23 additions and 14 deletions

View File

@ -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,22 @@ 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 label eth0:"
+ pac.getName()
);
}
private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {

View File

@ -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