setup a network interface only if the pac has its own IP address

This commit is contained in:
Peter Hormanns 2022-07-29 11:57:31 +02:00
parent 828420d4a7
commit c308720e84
6 changed files with 20 additions and 4 deletions

View File

@ -130,6 +130,16 @@ public class Hive extends AbstractEntity implements Serializable {
return webpacs; return webpacs;
} }
public List<Pac> getPacsWithIPAddress() {
final ArrayList<Pac> pacsWithIPAddress = new ArrayList<Pac>();
for (final Pac pac : pacs) {
if (!pac.isManagedServer() && !pac.usesPacIPAddress()) {
pacsWithIPAddress.add(pac);
}
}
return pacsWithIPAddress;
}
public void setPacs(Set<Pac> pacs) { public void setPacs(Set<Pac> pacs) {
this.pacs = pacs; this.pacs = pacs;
} }

View File

@ -294,4 +294,10 @@ public class Pac extends AbstractEntity implements Serializable {
String basepacName = getBasepac().getName(); String basepacName = getBasepac().getName();
return BasePacType.PAC_SRV.equals(basepacName); return BasePacType.PAC_SRV.equals(basepacName);
} }
public boolean usesPacIPAddress() {
String hiveIP = hive.getInetAddr().getInet4Addr();
String pacIP = getCurINetAddr().getInet4Addr();
return pacIP.equals(hiveIP);
}
} }

View File

@ -14,7 +14,7 @@ ff02::3 ip6-allhosts
${hive.inetAddr.inet4Addr} ${hive.name}.hostsharing.net ${hive.name} localhive ${hive.inetAddr.inet4Addr} ${hive.name}.hostsharing.net ${hive.name} localhive
${hive.inetAddr.inet6Addr} ${hive.name}.hostsharing.net ${hive.name} localhive ${hive.inetAddr.inet6Addr} ${hive.name}.hostsharing.net ${hive.name} localhive
#foreach( $pac in ${hive.webpacs} ) #foreach( $pac in ${hive.pacsWithIPAddress} )
${pac.curINetAddr.inet4Addr} ${pac.name}.hostsharing.net ${pac.name} ${pac.curINetAddr.inet4Addr} ${pac.name}.hostsharing.net ${pac.name}
${pac.curINetAddr.inet6Addr} ${pac.name}.hostsharing.net ${pac.name} ${pac.curINetAddr.inet6Addr} ${pac.name}.hostsharing.net ${pac.name}
#end #end

View File

@ -3,7 +3,7 @@
# Do not edit manually. Changes will be overwritten. # Do not edit manually. Changes will be overwritten.
# #
#foreach( $pac in ${hive.webpacs} ) #foreach( $pac in ${hive.pacsWithIPAddress} )
<VirtualHost ${pac.curINetAddr.inet4Addr}:80 [${pac.curINetAddr.inet6Addr}]:80> <VirtualHost ${pac.curINetAddr.inet4Addr}:80 [${pac.curINetAddr.inet6Addr}]:80>
ServerName _ ServerName _
ServerAdmin webmaster@${pac.name}.hostsharing.net ServerAdmin webmaster@${pac.name}.hostsharing.net

View File

@ -3,6 +3,6 @@
# Do not edit manually. Changes will be overwritten. # Do not edit manually. Changes will be overwritten.
# #
# #
#foreach( $pac in ${hive.webpacs} ) #foreach( $pac in ${hive.pacsWithIPAddress} )
eth0|${pac.name}|${pac.curINetAddr.inet4Addr}/32 eth0|${pac.name}|${pac.curINetAddr.inet4Addr}/32
#end #end

View File

@ -3,6 +3,6 @@
# Do not edit manually. Changes will be overwritten. # Do not edit manually. Changes will be overwritten.
# #
# #
#foreach( $pac in ${hive.webpacs} ) #foreach( $pac in ${hive.pacsWithIPAddress} )
eth0|${pac.name}|${pac.curINetAddr.inet6Addr}/128 eth0|${pac.name}|${pac.curINetAddr.inet6Addr}/128
#end #end