pf-tools commit: r578 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Net.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Feb 5 14:54:31 UTC 2008
Author: ccaillet-guest
Date: Tue Feb 5 14:54:31 2008
New Revision: 578
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=578
Log:
* factorizing code in Add_server from Net.pm
Modified:
trunk/debian/changelog
trunk/lib/PFTools/Net.pm
Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=578&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Tue Feb 5 14:54:31 2008
@@ -31,7 +31,7 @@
for the vlan
* adding ERR: message and aborting when two interfaces are on the same vlan
for a same host
- * factorizing code for route/delroute definition in Add_server from Net.pm
+ * factorizing code in Add_server from Net.pm
[ Thomas Parmelan ]
* lib-net: if no comment is specified in a zone, network or server
Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=578&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Tue Feb 5 14:54:31 2008
@@ -933,83 +933,33 @@
$M->{'route'} = {};
$M->{'delroute'} = {};
- if ( defined( $S->{'filename'}->{$mnamindexnum} ) ) {
- $M->{'filename'} = $S->{'filename'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'filename'}->{'default'} ) ) {
- $M->{'filename'} = $S->{'filename'}->{'default'};
- }
-
- if ( defined( $S->{'pxefilename'}->{$mnamindexnum} ) ) {
- $M->{'pxefilename'} = $S->{'pxefilename'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'pxefilename'}->{'default'} ) ) {
- $M->{'pxefilename'} = $S->{'pxefilename'}->{'default'};
- }
-
- if ( defined( $S->{'umlfilename'}->{$mnamindexnum} ) ) {
- $M->{'umlfilename'} = $S->{'umlfilename'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'umlfilename'}->{'default'} ) ) {
- $M->{'umlfilename'} = $S->{'umlfilename'}->{'default'};
- }
-
- if ( defined( $S->{'vmwfilename'}->{$mnamindexnum} ) ) {
- $M->{'vmwfilename'} = $S->{'vmwfilename'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'vmwfilename'}->{'default'} ) ) {
- $M->{'vmwfilename'} = $S->{'vmwfilename'}->{'default'};
- }
-
- if ( defined( $S->{'pxelinuxconf'}->{$mnamindexnum} ) ) {
- $M->{'pxelinuxconf'} = $S->{'pxelinuxconf'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'pxelinuxconf'}->{'default'} ) ) {
- $M->{'pxelinuxconf'} = $S->{'pxelinuxconf'}->{'default'};
- }
-
- if ( defined( $S->{'pxetemplate'}->{$mnamindexnum} ) ) {
- $M->{'pxetemplate'} = $S->{'pxetemplate'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'pxetemplate'}->{'default'} ) ) {
- $M->{'pxetemplate'} = $S->{'pxetemplate'}->{'default'};
- }
-
- if ( defined( $S->{'dns'}->{$mnamindexnum} ) ) {
- $M->{'dns'} = $S->{'dns'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'dns'}->{'default'} ) ) {
- $M->{'dns'} = $S->{'dns'}->{'default'};
- }
-
- if ( defined( $S->{'initrd'}->{$mnamindexnum} ) ) {
- $M->{'initrd'} = $S->{'initrd'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'initrd'}->{'default'} ) ) {
- $M->{'initrd'} = $S->{'initrd'}->{'default'};
- }
- else {
- # pour ne pas être obligé d'ajouter "initrd.default = initrd"
- # à toutes les déclarations de serveurs dans private-network
- $M->{'initrd'} = 'initrd';
- }
-
- if ( defined( $S->{'cmdline'}->{$mnamindexnum} ) ) {
- $M->{'cmdline'} = $S->{'cmdline'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'cmdline'}->{'default'} ) ) {
- $M->{'cmdline'} = $S->{'cmdline'}->{'default'};
- }
-
- if ( defined( $S->{'console'}->{$mnamindexnum} ) ) {
- $M->{'console'} = $S->{'console'}->{$mnamindexnum};
- }
- elsif ( defined( $S->{'console'}->{'default'} ) ) {
- $M->{'console'} = $S->{'console'}->{'default'};
- }
- elsif ( defined $Z->{'SOA'}->{'console'} ) {
- $M->{'console'} = $Z->{'SOA'}->{'console'};
- }
+ my @common_keys = (
+ 'filename',
+ 'pxefilename',
+ 'umlfilename',
+ 'vmwfilename',
+ 'pxelinuxconf',
+ 'pxetemplate',
+ 'dns',
+ 'initrd',
+ 'cmdline',
+ 'console'
+ ) ;
+ foreach my $key ( @common_keys ) {
+ if ( defined ( $S->{$key}->{$mnamindexnum} ) ) {
+ $M->{$key} = $S->{$key}->{$mnamindexnum} ;
+ }
+ elsif ( defined ( $S->{$key}->{'default'} ) ) {
+ $M->{$key} = $S->{$key}->{'default'} ;
+ }
+ elsif ( $key eq 'initrd' ) {
+ $M->{'initrd'} = 'initrd' ;
+ }
+ elsif ( $key eq 'console' && defined $Z->{'SOA'}->{'console'} ) {
+ $M->{'console'} = $Z->{'SOA'}->{'console'};
+ }
+ }
+
delete $M->{'console'} if $M->{'console'} and $M->{'console'} eq 'default';
# vrrp?
More information about the pf-tools-commits
mailing list