pf-tools commit: r568 [parmelan-guest] - in /trunk: debian/changelog installers/install.dist-2.6 tools/pflaunch

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Jan 22 13:48:04 UTC 2008


Author: parmelan-guest
Date: Tue Jan 22 13:48:04 2008
New Revision: 568

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=568
Log:
* Merge the remaining changes from 0.32.47-1 and 0.32.48-1.

Modified:
    trunk/debian/changelog
    trunk/installers/install.dist-2.6
    trunk/tools/pflaunch

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=568&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Tue Jan 22 13:48:04 2008
@@ -27,8 +27,28 @@
     their periods of activity on each file. Feel free to correct this if I
     made mistakes...
   * Update my email address.
+  * Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
 
  -- Christophe Caillet <quadchris at free.fr>  Mon, 21 Jan 2008 14:48:58 +0100
+
+pf-tools (0.32.48-1) unstable; urgency=low
+
+  [ Thomas Parmelan ]
+  * pflaunch uses Sitalibs::Config instead of lib-net's Load_conf((), but
+    Sitalibs::Config does not understand theses comments :
+
+        key = something # comment
+
+    and therefore uses 'something # comment' instead of just 'something' as
+    the key value.
+
+    pflaunch now explicitly strips those comments to avoid doing evil, stupid
+    things (such as trying to use "1.2.3.4 # FIXME" as an IP address).
+
+  [ Christophe Caillet ]
+  * new (optional) "pxetemplate" directive (see README.doc for more information).
+
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Fri, 18 Jan 2008 17:21:28 +0100
 
 pf-tools (0.32.47-1) unstable; urgency=low
 

Modified: trunk/installers/install.dist-2.6
URL: http://svn.debian.org/wsvn/pf-tools/trunk/installers/install.dist-2.6?rev=568&op=diff
==============================================================================
--- trunk/installers/install.dist-2.6 (original)
+++ trunk/installers/install.dist-2.6 Tue Jan 22 13:48:04 2008
@@ -697,8 +697,6 @@
 	optional
 	append="$lilo_append"
 # END lilo.conf
-# FIXME pouvoir conditionner le console= pour faciliter le deploiement de machines
-# physiques sur les plateformes UML
 
         #----------------------------------------------------------------------
         close(LILO);

Modified: trunk/tools/pflaunch
URL: http://svn.debian.org/wsvn/pf-tools/trunk/tools/pflaunch?rev=568&op=diff
==============================================================================
--- trunk/tools/pflaunch (original)
+++ trunk/tools/pflaunch Tue Jan 22 13:48:04 2008
@@ -47,14 +47,14 @@
 my $HOSTNAME = hostname;
 
 # paths
-my $umlaunch        = "/usr/local/sbin/umlaunch";
-my $cfgpath         = "/var/lib/cvsguest/$HOSTNAME/config/GLOBAL";
-my $configfile      = "$cfgpath/PF/$HOSTNAME.cfg";
-my $privatenetwork  = "$cfgpath/private-network";
-my $PF_STATUS_DIR   = "/var/lib/pftools";
-my $CVS_CHECKOUT    = "/var/lib/cvsguest";
-my $uml_switch_pipe = "/var/run/uml-utilities/uml_switch.ctl";
-my $logfile         = "/var/log/pflaunch";
+my $umlaunch           = "/usr/local/sbin/umlaunch";
+my $cfgpath            = "/var/lib/cvsguest/$HOSTNAME/config/GLOBAL";
+my $configfile         = "$cfgpath/PF/$HOSTNAME.cfg";
+my $privatenetworkfile = "$cfgpath/private-network";
+my $PF_STATUS_DIR      = "/var/lib/pftools";
+my $CVS_CHECKOUT       = "/var/lib/cvsguest";
+my $uml_switch_pipe    = "/var/run/uml-utilities/uml_switch.ctl";
+my $logfile            = "/var/log/pflaunch";
 
 # constantes
 my $vlan_default_mtu = "1468";
@@ -67,13 +67,14 @@
 ####### GLOBAL
 my $cache;
 my $options;
-my $cvsupdated;
+my $cvsupdated      = 0;
+my $private_network = undef;    # hash for $privatenetworkfile
 
 # Compte les alias créés
 my %ifAliasCpt;
 
-Config_Need_Preproc($privatenetwork);
-Config_Set_Var( $privatenetwork, ["UML"] );
+Config_Need_Preproc($privatenetworkfile);
+Config_Set_Var( $privatenetworkfile, ["UML"] );
 
 if (   `which vconfig 2>/dev/null` eq ""
     || `which brctl 2>/dev/null`  eq ""
@@ -81,6 +82,23 @@
     || `which screen 2>/dev/null` eq "" )
 {
     __Fault("Sorry, I need vlan, bridge-utils, uml-utilities and screen");
+}
+
+#
+#   update-config strips comments, but Sitalibs::Config does not...
+#
+sub __suppress_comments_in_keys {
+    my ($a) = @_;
+
+    return unless $a and ref $a eq 'HASH';
+
+    foreach my $section ( keys %$a ) {
+	foreach my $key ( keys %{ $a->{$section} } ) {
+	    $a->{$section}->{$key} =~ s/\s+#\s+.*$//;
+	}
+    }
+
+    return $a;
 }
 
 #
@@ -160,8 +178,8 @@
 	$famille = $1;
 	$num     = $2;
 	$section = $famille . "%%";
-	unless ( defined Config_Section( $privatenetwork, $section ) ) {
-	    if ( defined Config_Section( $privatenetwork, $vm ) ) {
+	unless ( exists $private_network->{$section} ) {
+	    if ( exists $private_network->{$vm} ) {
 		__Info(
 		    "La section $section n'existe pas, c'est $vm qui sera prise à la place"
 		);
@@ -181,9 +199,7 @@
 	$famille = $1;
 	$num     = 0;
 	$section = $famille;
-	unless (
-	    Config_Key( $privatenetwork, $section, "umlfilename.default" ) )
-	{
+	unless ( $private_network->{$section}->{'umlfilename.default'} ) {
 	    __Info(
 		"Attention, la machine `$vm' n'a pas de clef umlfilename.default, elle ne sera donc pas lancée"
 	    );
@@ -206,7 +222,7 @@
 sub __GetVMAlias ($) {
     my ( $famille, $num, $section ) = __FamillyNumFromVM(shift);
 
-    my $s = Config_Section( $privatenetwork, $section );
+    my $s = $private_network->{$section};
 
     __Fault("Familly '$famille' NOT found !")
 	unless ( defined($s) and ($section) );
@@ -232,7 +248,7 @@
 
     my ( $famille, $num, $section ) = __FamillyNumFromVM($vm);
 
-    my $s = Config_Section( $privatenetwork, $section );
+    my $s = $private_network->{$section};
     __Fault("Familly '$famille' NOT found !") unless ( defined($s) and ($s) );
 
     # Recherche des ipstart
@@ -257,8 +273,8 @@
     # Creation des adresses
     foreach my $key ( keys %$s ) {
 	if ( $key =~ /^interface\.\S+/ ) {
-	    my $vlan = $s->{$key};
-	    my $network = Config_Key( $privatenetwork, $vlan, "network" );
+	    my $vlan    = $s->{$key};
+	    my $network = $private_network->{$vlan}->{'network'};
 	    __Err("Can't get IP of vlan $vlan") unless defined $network;
 	    my $ip = Address(
 		$network,
@@ -301,11 +317,11 @@
     foreach my $vm (@$section_start) {
 	my ( $famille, $num, $section ) = __FamillyNumFromVM($vm);
 
-	my $s = Config_Section( $privatenetwork, $section );
+	my $s = $private_network->{$section};
 
 	unless ($s) {
 	    __Fault(
-		"(Je ne peux pas lire la section `$section` from $privatenetwork pour la vm `$vm'"
+		"(Je ne peux pas lire la section `$section` from $privatenetworkfile pour la vm `$vm'"
 	    );
 	}
 
@@ -355,9 +371,9 @@
 sub __GetVLanSetup ($) {
     my $vlan = shift;
 
-    my $section = Config_Section( $privatenetwork, $vlan );
-
-    __Err("Can't read section [$vlan] from `$privatenetwork'")
+    my $section = $private_network->{$vlan};
+
+    __Err("Can't read section [$vlan] from `$privatenetworkfile'")
 	unless ( defined($section) and ($section) );
     return $section;
 }
@@ -397,7 +413,7 @@
 
     my ( $famille, $num, $section ) = __FamillyNumFromVM($vm);
 
-    my $s = Config_Section( $privatenetwork, $section );
+    my $s = $private_network->{$section};
 
     my @ipstart;
     if ( $s->{ "ipstart." . $vlan } ) {
@@ -415,9 +431,9 @@
     push @ipstart, "0" while ( @ipstart < 4 );
     @ipstart = reverse @ipstart;
 
-    my $n = Config_Key( $privatenetwork, $vlan, "network" );
+    my $n = $private_network->{$vlan}->{'network'};
     __Fault(  "Je ne peux pas lire la s network du "
-	    . "vlan `$vlan' dans le private-network" )
+	    . "vlan `$vlan' dans '$privatenetworkfile'" )
 	unless $n;
 
     my @n_ip;
@@ -534,7 +550,7 @@
 	my ( $ip, $mask ) = @$cidr;
 
 	my $ifbr = $brname;
-	$ifbr .= ":"    if ($i);
+	$ifbr .= ":" if ($i);
 	$ifbr .= $i - 1 if ($i);
 	print STATUS_IFBR $ifbr . "\n";
 
@@ -806,10 +822,7 @@
 
 	    my ( undef, undef, $section ) = __FamillyNumFromVM($host);
 	    unless (
-		Config_Key(
-		    $privatenetwork, $section, "umlfilename.default"
-		)
-		)
+		exists $private_network->{$section}->{'umlfilename.default'} )
 	    {
 		__Info(
 		    "Attention, la machine `$host' n'a pas de clef umlfilename.default,"
@@ -1108,7 +1121,7 @@
 	"Erreur pour '$vlan' : la présence d'une clef 'if' est obligatoire au moins dans la section [vlan-default]"
     ) unless $vlan_if;
 
-    my $vlandata = Config_Section( $privatenetwork, $vlan );
+    my $vlandata = $private_network->{$vlan};
     unless ($vlandata) {
 	__Debug(
 	    "Erreur je n'arrive pas a lire dans private-network les infos du vlan `$vlan'"
@@ -1479,10 +1492,6 @@
 
     }
     else {
-
-	my $pflaunchcfg;
-	my $privatenetworkcfg;
-	my $runningbranche;
 	my $branchecvs = __GetBrancheCVS();
 
 	__Info("Getting config from CVS");
@@ -1499,11 +1508,14 @@
 		"Je n'arrive pas a lire $configfile, vérifiez votre installation"
 	    );
 	}
-	unless ( -r $privatenetwork ) {
+	unless ( -r $privatenetworkfile ) {
 	    __Fault(
-		"Je n'arrive pas a lire $privatenetwork, vérifiez votre installation"
+		"Je n'arrive pas a lire $privatenetworkfile, vérifiez votre installation"
 	    );
 	}
+
+	$private_network = Load_Config($privatenetworkfile);
+	__suppress_comments_in_keys($private_network);
     }
 
 }
@@ -1893,7 +1905,7 @@
 	    . "flag '--nocvsupdate' !" );
 }
 
-mkdir($PF_STATUS_DIR)               unless ( -d $PF_STATUS_DIR );
+mkdir($PF_STATUS_DIR) unless ( -d $PF_STATUS_DIR );
 mkdir( $PF_STATUS_DIR . "/bridge" ) unless ( -d $PF_STATUS_DIR . "/bridge" );
 __Fault("uml_switch est il lancé ? (Paquage uml-utilities)")
     unless ( -S $uml_switch_pipe );




More information about the pf-tools-commits mailing list