[Fai-commit] r3659 - people/michael/features/setup_harddisks_2/implementation

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Sun Jul 23 11:20:14 UTC 2006


Author: michael-guest
Date: 2006-07-23 11:20:09 +0000 (Sun, 23 Jul 2006)
New Revision: 3659

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2
   people/michael/features/setup_harddisks_2/implementation/shdd2-exec
   people/michael/features/setup_harddisks_2/implementation/shdd2-init
   people/michael/features/setup_harddisks_2/implementation/shdd2-lib
   people/michael/features/setup_harddisks_2/implementation/shdd2-parser
   people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
Log:
fixes and cleanup


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2	2006-07-23 11:20:09 UTC (rev 3659)
@@ -4,8 +4,6 @@
 
 package FAI;
 
-my $debug = 1;
-
 require "shdd2-lib";
 require "shdd2-init";
 require "shdd2-parser";

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-exec
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-exec	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-exec	2006-07-23 11:20:09 UTC (rev 3659)
@@ -66,7 +66,7 @@
 {
   my ( $command, $stdout_ref, $stderr_ref ) = @_;
   my $err = &execute_command( $command, $stdout_ref, $stderr_ref );
-  unless( $err eq "")
+  unless ( $err eq "" )
   {
     my $response = &get_error( $err, "response" );
     my $message  = &get_error( $err, "message" );
@@ -94,7 +94,11 @@
   my @stdout      = ();
   my $stderr_line = "";
   my $stdout_line = "";
-  my $run         = $ENV{"NO_DRY_RUN"};
+  my $run         = 0;
+  if ( defined( $ENV{"NO_DRY_RUN"} ) && !( $ENV{"NO_DRY_RUN"} =~ /^\s*$/ ) )
+  {
+    $run = 1;
+  }
 
   ( my $stderr_fh, my $stderr_filename ) = File::Temp::tempfile();
   ( my $stdout_fh, my $stdout_filename ) = File::Temp::tempfile();

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-init
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-init	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-init	2006-07-23 11:20:09 UTC (rev 3659)
@@ -4,6 +4,8 @@
 
 package FAI;
 
+$FAI::debug = 1;
+
 # getopt processing
 
 #REMOVE THIS

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-lib
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-lib	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-lib	2006-07-23 11:20:09 UTC (rev 3659)
@@ -19,7 +19,7 @@
 
 sub print_hash
 {
-  ( $debug > 0 ) or return 0;
+  ( $FAI::debug > 0 ) or return 0;
 
   my ( $hash_ref, $k ) = @_;
   $k = "$k>";

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-parser
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2006-07-23 11:20:09 UTC (rev 3659)
@@ -350,7 +350,7 @@
           }
           else
           {
-            die "partition number of to-be-preserved partition $1 changed to $FAI::partition_pointer->{ "number" }\n";
+            die "partition number of to-be-preserved partition $1 changed to $FAI::partition_pointer->{number}\n";
           }
         }
         | /^[^\d,:\s\-][^,:\s]*(:(spare|missing))*(,[^,:\s]+(:(spare|missing))*)*\s+/
@@ -400,7 +400,7 @@
   my $input = <STDIN>;
   $/ = $ifs;
 
-  ( $debug > 0 ) and print "Input was:\n" . $input;
+  ( $FAI::debug > 0 ) and print "Input was:\n" . $input;
 
   defined $FAI::Parser->file($input) or die "Syntax error\n";
 }

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-23 11:04:18 UTC (rev 3658)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-23 11:20:09 UTC (rev 3659)
@@ -20,9 +20,11 @@
 
     while (1)
     {
+      $ENV{"NO_DRY_RUN"} = "1";
       my $error =
         &FAI::execute_command( "$FAI::parted_binary $disk unit TB print",
         \@parted_print, 0 );
+      $ENV{"NO_DRY_RUN"} = "";
 
       if ( $error eq "parted_2"
         ) #this error happens when the disk has no disk label. then, parted provides no information about the disk
@@ -53,6 +55,7 @@
 
     foreach my $line (@parted_print)
     {
+      print "$line";
       if ( $line =~ /^Disk geometry/ )
       {
         next;
@@ -92,9 +95,11 @@
       }
     }
 
+    $ENV{"NO_DRY_RUN"} = "1";
     @parted_print = ();
     &FAI::execute_command_std( "$FAI::parted_binary $disk unit B print",
       \@parted_print, 0 );
+    $ENV{"NO_DRY_RUN"} = "";
 
     foreach my $line (@parted_print)
     {
@@ -136,9 +141,11 @@
       }
     }
 
+    $ENV{"NO_DRY_RUN"} = "1";
     @parted_print = ();
     &FAI::execute_command_std( "$FAI::parted_binary $disk unit chs print",
       \@parted_print, 0 );
+    $ENV{"NO_DRY_RUN"} = "";
 
     foreach my $line (@parted_print)
     {




More information about the Fai-commit mailing list