[Fai-commit] r3650 -
people/michael/features/setup_harddisks_2/implementation
fai-commit at lists.alioth.debian.org
fai-commit at lists.alioth.debian.org
Sun Jul 23 10:25:18 UTC 2006
Author: michael-guest
Date: 2006-07-23 10:25:17 +0000 (Sun, 23 Jul 2006)
New Revision: 3650
Modified:
people/michael/features/setup_harddisks_2/implementation/shdd2-exec
people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
Log:
Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-exec
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-exec 2006-07-23 10:17:07 UTC (rev 3649)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-exec 2006-07-23 10:25:17 UTC (rev 3650)
@@ -13,6 +13,7 @@
".*Error: Could not stat device rm - No such file or directory.*",
stdout_regex => "",
program => "parted",
+ response => "die",
},
{
error => "parted_2",
@@ -20,6 +21,7 @@
stderr_regex => ".*Error: Unable to open .* - unrecognised disk label.*",
stdout_regex => "",
program => "parted",
+ response => "die",
},
{
error => "parted_3",
@@ -28,6 +30,7 @@
".*Error: Could not stat device .* - No such file or directory.*",
stdout_regex => "",
program => "parted",
+ response => "die"
},
{
error => "port_1",
@@ -35,6 +38,7 @@
stderr_regex => ".*Error: .* Port test not found.*",
stdout_regex => "",
program => "port",
+ response => "die"
},
];
@@ -48,6 +52,16 @@
}
}
+sub get_error
+{
+ my ($error,$field) = @_;
+ my @treffer = grep { $_->{error} eq "$error" } @$FAI::error_codes;
+ foreach my $m (@treffer) #returns the first found error message.
+ {
+ return "$m->{$field}";
+ }
+}
+
sub execute_command
{
my ( $command, $stdout_ref, $stderr_ref ) = @_;
Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-sizes 2006-07-23 10:17:07 UTC (rev 3649)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-sizes 2006-07-23 10:25:17 UTC (rev 3650)
@@ -20,25 +20,28 @@
while (1)
{
- my $error = &FAI::execute_command( "/sbin/parted -s $disk unit TB print",
- \@parted_std_out, 0 );
+ my $error = &FAI::execute_command( "$FAI::parted_binary $disk unit TB print",
+ \@parted_print, 0 );
- if ( $error eq "parted_2" )
+ if ( $error eq "parted_2" ) #this error happens when the disk has no disk label. then, parted provides no information about the disk
{
- $error = &FAI::execute_command("/sbin/parted -s $disk mklabel msdos");
+ $error = &FAI::execute_command("$FAI::parted_binary $disk mklabel msdos");
next;
}
- if ( $error eq "parted_3" )
+ if ($error ne "")
{
- die $FAI::ErrorHash{"parted_3"};
+ my $response = &FAI::get_error($error, "response");
+ if( $response eq "die")
+ {
+ die &FAI::get_error($error, "message");
+ }
+ if( $response eq "warn")
+ {
+ warn &FAI::get_error($error, "message");
+ }
}
- if ( $error eq "parted_1" )
- {
- die $FAI::ErrorHash{"parted_1"};
- }
-
last;
}
@@ -86,7 +89,7 @@
}
}
- @parted_print = split( "\n", `/sbin/parted -s $disk unit B print` );
+ @parted_print = split( "\n", `$FAI::parted_binary $disk unit B print` );
{
foreach my $line (@parted_print)
{
@@ -129,7 +132,7 @@
}
}
- @parted_print = split( "\n", `/sbin/parted -s $disk unit chs print` );
+ @parted_print = split( "\n", `$FAI::parted_binary $disk unit chs print` );
{
foreach my $line (@parted_print)
{
More information about the Fai-commit
mailing list