pf-tools commit: r700 [parmelan-guest] - in /branches/0.33-stable: debian/changelog filters/filter_distrib lib/PFTools/Conf.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Wed Mar 18 14:41:38 UTC 2009
Author: parmelan-guest
Date: Wed Mar 18 14:41:38 2009
New Revision: 700
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=700
Log:
* filters/filter_distrib:
- exit with a proper error message if the specified host does not exist or
its configuration is incomplete.
- removed an unused variable.
* lib/PFTools/Conf.pm:
- in Init_SUBST(): comment the hostname regexp.
Modified:
branches/0.33-stable/debian/changelog
branches/0.33-stable/filters/filter_distrib
branches/0.33-stable/lib/PFTools/Conf.pm
Modified: branches/0.33-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/debian/changelog?rev=700&op=diff
==============================================================================
--- branches/0.33-stable/debian/changelog (original)
+++ branches/0.33-stable/debian/changelog Wed Mar 18 14:41:38 2009
@@ -9,10 +9,19 @@
- added myself as uploader, to please dch.
- pf-host: depends: libdigest-crc-perl
+ * filters/filter_distrib:
+ - exit with a proper error message if the specified host does not exist or
+ its configuration is incomplete.
+ - removed an unused variable.
+
+ * lib/PFTools/Conf.pm:
+ - in Init_SUBST(): comment the hostname regexp.
+
* lib/PFTools/Net.pm:
- also export cmpif() and Host_class().
- corrected a few typos in error messages, and a few indentation cases.
- - don't force bonding interfaces names to start with "bond".
+ - don't force bonding interfaces names to start with "bond" (this also
+ allows vlan tagging on bond interfaces).
* lib/PFTools/Update.pm:
- also export CVS_update().
@@ -20,7 +29,7 @@
* tools/kvmlaunch:
- new script.
- -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org> Mon, 16 Mar 2009 14:41:21 +0100
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org> Wed, 18 Mar 2009 15:30:55 +0100
pf-tools (0.33.16-1) unstable; urgency=low
Modified: branches/0.33-stable/filters/filter_distrib
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/filters/filter_distrib?rev=700&op=diff
==============================================================================
--- branches/0.33-stable/filters/filter_distrib (original)
+++ branches/0.33-stable/filters/filter_distrib Wed Mar 18 14:41:38 2009
@@ -22,7 +22,7 @@
use strict;
use warnings;
-use PFTools::Conf ;
+use PFTools::Conf;
use PFTools::Net;
use PFTools::Update;
@@ -59,18 +59,38 @@
exit 1 ;
}
-my $PF_NET = Init_lib_net( Get_source("GLOBAL:private-network") ) ;
-my $hosttype = $SUBST{'HOSTTYPE'} ;
-my $host_distrib = $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$hosttype}->{'SRVLIST'}->{$host}->{'distrib'} ;
-my $host_distsrc = $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$hosttype}->{'SRVLIST'}->{$host}->{'deploymode'} ;
-$host_distsrc =~ s/^(debian|ubuntu)-installer$/$1/ ;
+my $PF_NET = Init_lib_net( Get_source("GLOBAL:private-network") );
+
+Init_SUBST( \%SUBST, $host, 'private' ); # does an Abort if $host is not parsable
+
+my $host_type = $SUBST{'HOSTTYPE'};
+
+unless ($PF_NET->{'SERVERS'}->{'BY_NAME'}->{$host_type}) {
+ die "FATAL: unable to find config for host type $host_type";
+}
+
+unless ($PF_NET->{'SERVERS'}->{'BY_NAME'}->{$host_type}->{'SRVLIST'}->{$host}) {
+ die "FATAL: unable to find config for host $host";
+}
+
+my ($host_distrib, $host_distsrc) =
+ @{ $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$host_type}->{'SRVLIST'}->{$host} }{ qw(distrib deploymode) };
+
+unless ($host_distrib) {
+ die "FATAL: unable do find distrib for host $host";
+}
+
+unless ($host_distsrc) {
+ die "FATAL: unable do find deploymode for host $host";
+}
+
+$host_distsrc =~ s/^(debian|ubuntu)-installer$/$1/;
open SRC, "<$src" or die "open: $src: $!\n";
open DST, ">$dst" or die "open: $dst: $!\n";
while (<SRC>) {
my $line = $_;
- my $pos = length $line;
$line =~ s/%DISTSRC%/$host_distsrc/gs ;
$line =~ s/%DISTRIB%/$host_distrib/gs ;
Modified: branches/0.33-stable/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/lib/PFTools/Conf.pm?rev=700&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Conf.pm (original)
+++ branches/0.33-stable/lib/PFTools/Conf.pm Wed Mar 18 14:41:38 2009
@@ -89,7 +89,29 @@
}
}
chomp ( $ref_subst->{'OS_RELEASE'} = `/bin/uname -r` ) ;
- $ref_subst->{'HOSTNAME'} =~ m/^((([a-z]{3}[\d]{1})-)?([a-z\-0-9]+[a-z\-]))([\d]*)([a-z]*)$/ ;
+
+ my $host_regex = qr{
+ \A
+ ( # HOSTTYPE
+ (
+ ( # POPNAME (optional)
+ [a-z]{3}\d{1}
+ )
+ -
+ )?
+ (
+ [a-z0-9-]+[a-z-] # host type (without the POP name)
+ )
+ )
+ (\d*) # HOSTDIGITS (optional)
+ ([a-z]*) # HOSTNODEINDEX (optional)
+ \z
+ }xms;
+
+ unless ($ref_subst->{'HOSTNAME'} =~ m/$host_regex/) {
+ Abort( $ERR_OPEN, "Init_SUBST failed: invalid hostname $ref_subst->{'HOSTNAME'}" );
+ }
+
$ref_subst->{'HOSTTYPE'} = $1 ;
$ref_subst->{'HOSTDIGITS'} = $5 ;
$ref_subst->{'HOSTCLUSTER'} = $4.$5 ;
More information about the pf-tools-commits
mailing list