From 5a7dfa87b608366cd03b86c63af32f35ce1089b1 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 29 Jun 2017 10:55:23 +0200 Subject: [PATCH] interate only webpacs in templates --- hsarback/src/de/hsadmin/mods/pac/Hive.java | 12 ++++++++++++ hsarback/src/de/hsadmin/mods/pac/hosts.vm | 2 +- hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm | 6 +++--- hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm | 4 +--- .../src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm | 2 +- hsarback/src/de/hsadmin/mods/pac/sudoers-pacs.vm | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/pac/Hive.java b/hsarback/src/de/hsadmin/mods/pac/Hive.java index caa681e..537656e 100644 --- a/hsarback/src/de/hsadmin/mods/pac/Hive.java +++ b/hsarback/src/de/hsadmin/mods/pac/Hive.java @@ -6,6 +6,8 @@ import static javax.persistence.FetchType.LAZY; import static javax.persistence.GenerationType.SEQUENCE; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import javax.persistence.Column; @@ -117,6 +119,16 @@ public class Hive extends AbstractEntity implements Serializable { public Set getPacs() { return pacs; } + + public List getWebpacs() { + final ArrayList webpacs = new ArrayList(); + for (final Pac pac : pacs) { + if (!pac.isManagedServer()) { + webpacs.add(pac); + } + } + return webpacs; + } public void setPacs(Set pacs) { this.pacs = pacs; diff --git a/hsarback/src/de/hsadmin/mods/pac/hosts.vm b/hsarback/src/de/hsadmin/mods/pac/hosts.vm index 8163254..e4fbdb1 100644 --- a/hsarback/src/de/hsadmin/mods/pac/hosts.vm +++ b/hsarback/src/de/hsadmin/mods/pac/hosts.vm @@ -14,6 +14,6 @@ ff02::3 ip6-allhosts ${hive.inetAddr.inetAddr} ${hive.name}.hostsharing.net ${hive.name} localhive -#foreach( $pac in ${hive.pacs} ) +#foreach( $pac in ${hive.webpacs} ) ${pac.curINetAddr.inetAddr} ${pac.name}.hostsharing.net ${pac.name} #end diff --git a/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm b/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm index 8b1bf1d..92d9faf 100644 --- a/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm +++ b/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm @@ -3,10 +3,10 @@ # Do not edit manually. Changes will be overwritten. # -#foreach( $pac in ${hive.pacs} ) +#foreach( $pac in ${hive.webpacs} ) ServerName _ - ServerAdmin webmaster@${pac.getName} + ServerAdmin webmaster@${pac.getName}.hostsharing.net Redirect 404 / @@ -16,7 +16,7 @@ ServerName _ - ServerAdmin webmaster@${pac.getName} + ServerAdmin webmaster@${pac.getName}.hostsharing.net SSLEngine On SSLCertificateFile /etc/apache2/pems-enabled/${pac.getName}.crt 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 ef28820..aa542d0 100644 --- a/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm +++ b/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm @@ -3,8 +3,6 @@ # Do not edit manually. Changes will be overwritten. # # -#foreach( $pac in ${hive.pacs} ) -#if( !${pac.managedServer} ) +#foreach( $pac in ${hive.webpacs} ) eth0:${pac.name}:${pac.curINetAddr.inetAddr}/32 -#end #end \ No newline at end of file diff --git a/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm b/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm index c61476e..58250ad 100644 --- a/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm +++ b/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm @@ -3,7 +3,7 @@ # Do not edit manually. Changes will be overwritten. # -#foreach( $pac in ${hive.pacs} ) +#foreach( $pac in ${hive.webpacs} ) DefaultRoot ~ ${pac.name} ServerName "${pac.name}.hostsharing.net" diff --git a/hsarback/src/de/hsadmin/mods/pac/sudoers-pacs.vm b/hsarback/src/de/hsadmin/mods/pac/sudoers-pacs.vm index a9b6a5d..b1e20a3 100644 --- a/hsarback/src/de/hsadmin/mods/pac/sudoers-pacs.vm +++ b/hsarback/src/de/hsadmin/mods/pac/sudoers-pacs.vm @@ -3,6 +3,6 @@ # Do not edit manually. Changes will be overwritten. # -#foreach( $pac in ${hive.pacs} ) +#foreach( $pac in ${hive.webpacs} ) ${pac.name} ALL = (%${pac.name}) NOPASSWD: ALL #end