pf-tools commit: r649 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Net.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Fri Sep 26 14:52:20 UTC 2008
Author: ccaillet-guest
Date: Fri Sep 26 14:52:20 2008
New Revision: 649
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=649
Log:
Factorizing host properties with Get_Host_Props on 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=649&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Fri Sep 26 14:52:20 2008
@@ -7,8 +7,9 @@
* Fix parsing for /etc/pf-tools.conf file on Update.pm
* Transfering hardcoded value from mk_pxelinuxcfg to template
standard-installer for defining preseed server
-
- -- Christophe Caillet <quadchris at free.fr> Wed, 10 Sep 2008 14:48:06 +0200
+ * Factorizing host properties with Get_Host_Props on Net.pm
+
+ -- Christophe Caillet <quadchris at free.fr> Fri, 26 Sep 2008 16:51:11 +0200
pf-tools (0.33.1-1) unstable; urgency=low
Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=649&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Fri Sep 26 14:52:20 2008
@@ -330,14 +330,7 @@
my $lastused = -1;
my %umtap;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{SOA}->{name}$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
- my $hostclass = Host_class( $hostshort, $Z );
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ my $M = Get_Host_Props ( $Z, $host ) ;
if ( !defined($M) ) {
Abort( $ERR_SYNTAX, "UMRemap_If: " . $host . " not found" );
@@ -562,19 +555,7 @@
sub Get_UM_Filename {
my ( $Z, $host ) = @_;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{'SOA'}->{'name'}$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
-
- if ( !defined $hostshort ) {
- return undef;
- }
-
- my $hostclass = Host_class( $hostshort, $Z );
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ my $M = Get_Host_Props ( $Z, $host ) ;
if ( !defined($M) ) {
return undef;
@@ -587,19 +568,7 @@
sub Get_Initrd_Filename ($$) {
my ( $Z, $host ) = @_;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{'SOA'}->{'name'}$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
-
- if ( !defined $hostshort ) {
- return undef;
- }
-
- my $hostclass = Host_class( $hostshort, $Z );
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ my $M = Get_Host_Props ( $Z, $host ) ;
if ( !defined($M) ) {
return undef;
@@ -624,19 +593,7 @@
sub Get_Cmdline ($$) {
my ( $Z, $host ) = @_;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{SOA}->{name}$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
-
- if ( !defined $hostshort ) {
- return undef;
- }
-
- my $hostclass = Host_class( $hostshort, $Z );
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ my $M = Get_Host_Props ( $Z, $host ) ;
if ( !defined($M) ) {
return undef;
@@ -682,25 +639,10 @@
sub Get_dns_from_hostname {
my ( $Z, $host ) = @_;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{SOA}->{name}$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
- my $hostnum = $hostshort;
- $hostnum =~ s/^.*?(\d*)[a-z]*$/$1/;
- $hostnum =~ s/^0*//;
- if ( $hostnum eq "" ) {
- $hostnum = 0;
- }
-
- if ( !defined $hostshort ) {
- return undef;
- }
-
- my $hostclass = Host_class( $hostshort, $Z );
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ $host =~ /^([^.]+)(\.([^.]+))?\.$Z->{SOA}->{name}$/ ;
+ my $hostnum = $1 ;
+ $hostnum =~ /.*([\d]+)$/ ;
+ my $M = Get_Host_Props ( $Z, $host ) ;
return Get_dns_from_zone( $Z, $M, $hostnum );
}
@@ -1865,24 +1807,9 @@
my $i;
my $j;
- my $host2 = $host;
- $host2 =~ s/^(.+)\.$Z->{SOA}->{name}\.?$/$1/;
- $host2 =~ m/^([^.]+)(\.([^.]+))?$/;
- my $hostshort = $1;
- my $hostvlan = $3;
-
- if ( !defined $hostshort ) {
- return undef;
- }
-
- my $hostclass = Host_class( $hostshort, $Z );
- if ( !defined $hostclass ) {
- return undef;
- }
-
- my $N = $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass};
-
- my $M = $N->{'SRVLIST'}->{$hostshort};
+ $host =~ /^([^.]+)(\.([^.]+))?\.$Z->{SOA}->{name}$/ ;
+ my ( $host2, $hostshort, $hostvlan ) = ( $1.$2, $1, $3 ) ;
+ my $M = Get_Host_Props ( $Z, $host ) ;
if ( defined( $M->{'zone'}->{$host2}->{'FIELD'} ) ) {
if ( $M->{'zone'}->{$host2}->{'TYPE'} eq "CNAME" ) {
More information about the pf-tools-commits
mailing list