pf-tools commit: r643 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Conf.pm lib/PFTools/Net.pm lib/PFTools/Update.pm sbin/mk_sourceslist
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Wed Sep 10 12:03:12 UTC 2008
Author: ccaillet-guest
Date: Wed Sep 10 12:03:11 2008
New Revision: 643
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=643
Log:
* Forward port commit 641 from 0.33-stable branch
* Fix parsing for /etc/pf-tools.conf file on Update.pm
Modified:
trunk/debian/changelog
trunk/lib/PFTools/Conf.pm
trunk/lib/PFTools/Net.pm
trunk/lib/PFTools/Update.pm
trunk/sbin/mk_sourceslist
Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=643&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Wed Sep 10 12:03:11 2008
@@ -3,8 +3,10 @@
* Factorizing code for Get_Active_Filename in Net.pm with Get_PXE_Filename
* Forward port commit 635 from 0.33-stable branch
* Forward port commit 638 from 0.33-stable branch
-
- -- Christophe Caillet <tof at sitadelle.com> Mon, 25 Aug 2008 14:38:22 +0200
+ * Forward port commit 641 from 0.33-stable branch
+ * Fix parsing for /etc/pf-tools.conf file on Update.pm
+
+ -- Christophe Caillet <tof at sitadelle.com> Wed, 10 Sep 2008 14:02:37 +0200
pf-tools (0.33.1-1) unstable; urgency=low
Modified: trunk/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Conf.pm?rev=643&op=diff
==============================================================================
--- trunk/lib/PFTools/Conf.pm (original)
+++ trunk/lib/PFTools/Conf.pm Wed Sep 10 12:03:11 2008
@@ -88,7 +88,7 @@
chomp( $SUBST{'OS_RELEASE'} = `/bin/uname -r` );
-$SUBST{'HOSTNAME'} =~ m/^((([a-z]{3}[\d]{1})-)?([a-z\-]+))([\d]*)([a-z]*)$/;
+$SUBST{'HOSTNAME'} =~ m/^((([a-z]{3}\d)-)?([a-z-]+))([\d]*)([a-z]*)$/;
$SUBST{'HOSTTYPE'} = $1;
$SUBST{'HOSTDIGITS'} = $5;
Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=643&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Wed Sep 10 12:03:11 2008
@@ -163,18 +163,23 @@
return $prefix;
}
+sub Get_Host_Props ($$) {
+ my ( $Z, $host ) = @_ ;
+
+ $host =~ /^([^.]+)(\.([^.]+))?\.$Z->{SOA}->{name}$/ ;
+ my ( $hostshort, $hostvlan ) = ( $1, $3 ) ;
+ return undef if ( ! defined $hostshort ) ;
+
+ my $hostclass = Host_class( $hostshort, $Z ) ;
+
+ return $Z->{'SERVERS'}->{'BY_NAME'}->{$hostclass}->{'SRVLIST'}->{$hostshort} ;
+}
+
# $interface Get_If ( $Zone, $host, $vlan )
sub Get_If {
my ( $Z, $host, $vlan ) = @_;
- 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, "Get_If: " . $host . " not found" );
@@ -190,14 +195,7 @@
my $dhcpvlanregex
= '^(' . join( '|', @{ $Z->{'SOA'}->{'dhcpvlan'} } ) . ')$';
- 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, "Get_Dhcp_Infos: " . $host . " not found" );
@@ -266,14 +264,7 @@
my $umif = {};
- 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, "Get_Dhcp_Infos: " . $host . " not found" );
@@ -657,23 +648,9 @@
sub Get_PXE_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};
-
- if ( !defined($M) ) {
- return undef;
- }
+ my $M = Get_Host_Props ( $Z, $host ) ;
+
+ return undef if ( !defined($M) ) ;
if ( $M->{'arch'} eq 'amd64' ) {
return ( $M->{'arch'}."/".$M->{'pxefilename'} );
@@ -686,6 +663,8 @@
sub Get_Active_Filename {
my ( $Z, $host ) = @_;
+
+ my $M = Get_Host_Props ( $Z, $host ) ;
return ( $M->{'umlfilename'} ) if ($PFTOOLS_VARS->{'UML'} && defined $M->{'umlfilename'});
return ( $M->{'vmwfilename'} ) if ($PFTOOLS_VARS->{'VMWARE'} && defined $M->{'vmwfilename'});
Modified: trunk/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Update.pm?rev=643&op=diff
==============================================================================
--- trunk/lib/PFTools/Update.pm (original)
+++ trunk/lib/PFTools/Update.pm Wed Sep 10 12:03:11 2008
@@ -93,7 +93,7 @@
my $CVS_ROOT = "/var/lib/cvs";
my $CVS_REPOSITORY = $CVS_ROOT . "/repository";
my $CVS_CONFIG = "config";
-my $CVS_COMMAND;
+our $CVS_COMMAND;
my $CVS_BRANCHE;
# End Conf Par Defaut!
@@ -1782,59 +1782,6 @@
FlushLog();
}
-# sub Do_help {
-#
-# print STDERR << "# ENDHELP";
-# Usage: $0 [options]
-# # -d --debug: print debug info
-# -u --diff: diff files, versions, mountpoints, links => --simul
-# -h --help: print help and exit
-# # -i --install: install mode
-# -s --simul: simulation mode, fake everything
-# -v --verbose: be more verbose
-# --branche-cvs=: update based on a specific CVS branche.
-#
-# # ENDHELP
-# }
-#
-# sub Get_options {
-# my (@argv) = @_;
-#
-# my %optionshash;
-# my $options;
-#
-# Getopt::Long::Configure("bundling");
-#
-# $optionshash{"branche-cvs"}='';
-# GetOptions(
-# \%optionshash, 'debug|d', 'diff|u', 'help|h',
-# 'install|i', 'simul|s', 'verbose|v', 'quiet|q',
-# 'noupdate', 'noaction', 'branche-cvs=s'
-# ) or die "GetOptions error, try --help: " . $!;
-#
-# $options = \%optionshash;
-#
-# if ( $options->{'quiet'} ) {
-# Log("update-config started in quiet mode...");
-# $DEFERREDLOG = 1;
-# }
-#
-# if ( $options->{'diff'} ) {
-# $options->{'simul'} = 1;
-# }
-#
-# if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-ACTION:' ) {
-# Warn( $ERR_OPEN, ":NO-ACTION: depreciated, please use --noaction" );
-# $options->{'noaction'} = 1;
-# }
-# if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-UPDATE:' ) {
-# Warn( $ERR_OPEN, ":NO-UPDATE: depreciated, please use --noupdate" );
-# $options->{'noupdate'} = 1;
-# }
-#
-# return $options;
-# }
-
sub Get_conf {
my $C = {};
Modified: trunk/sbin/mk_sourceslist
URL: http://svn.debian.org/wsvn/pf-tools/trunk/sbin/mk_sourceslist?rev=643&op=diff
==============================================================================
--- trunk/sbin/mk_sourceslist (original)
+++ trunk/sbin/mk_sourceslist Wed Sep 10 12:03:11 2008
@@ -100,11 +100,10 @@
$sources_content =~ s/%DISTRIB%/$ref_srv->{'distrib'}/gs ;
my $dist_src = $ref_srv->{'deploymode'} ;
- $dist_src =~ s/^(debian|ubuntu)-installer/$1/ ;
+ $dist_src =~ s/^(debian|ubuntu)-installer$/$1/ ;
- my $security ;
- ( $dist_src eq 'debian' ) ? $security = $ref_srv->{'distrib'}."/updates" : $security = $ref_srv->{'distrib'}."-security" ;
-
+ my $security = ( $dist_src eq 'debian' ) ? $ref_srv->{'distrib'}."/updates" : $ref_srv->{'distrib'}."-security" ;
+
$sources_content =~ s/%DISTSRC%/$dist_src/gs ;
$sources_content =~ s/%SECURITY%/$security/gs ;
$sources_content =~ s/%DEFAULT_SECTIONS%/$DEF_SECTIONS->{$dist_src}/gs ;
@@ -142,6 +141,9 @@
my $PF_NET = Init_lib_net ( Get_source ( $SRC ) ) ;
$HOST =~ /^(([^\-]{4})-)?([^\d]+)(([\d]+)([a-z]*))?$/ ;
-my $SRV = $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$1.$3}->{'SRVLIST'}->{$HOST} ;
+my ( $popname, $hosttype ) = ( $1, $3 ) ;
+my $key ;
+( defined $popname ) ? $key = $1.$3 : $key = $3 ;
+my $SRV = $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$key}->{'SRVLIST'}->{$HOST} ;
Mk_sourceslist ( $SRV, $DST, $TPL, $SECTIONS ) ;
More information about the pf-tools-commits
mailing list