|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd
This allows arguments with spaces, etc.
No functional change with the existing configurations I know about.
It would be good to fix this before any configurations are created
where this would make a difference...
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
Osstest/PDU/ipmi.pm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
index dbf211f..f3a50c9 100644
--- a/Osstest/PDU/ipmi.pm
+++ b/Osstest/PDU/ipmi.pm
@@ -49,11 +49,17 @@ sub pdu_power_state {
my ($mo, $on) = @_;
my $onoff= $on ? "on" : "off";
- my $cmd = "ipmitool -H $mo->{Mgmt} -U $mo->{User} -P $mo->{Pass}";
+ my @cmd = (qw(ipmitool -H), $mo->{Mgmt},
+ '-U',$mo->{User}, '-P',$mo->{Pass});
my $getstatus = sub {
- my $status = `$cmd power status`
- or die "Cannot retrieve current power status";
+ my @scmd = (@cmd, qw(power status));
+ logm("PDU IMPI: @scmd");
+ open IPMI, "-|", @scmd or die $!;
+ my $status = do { local $/=undef; <IPMI>; };
+ $?=0; $!=0;
+ close IPMI and $status or
+ die "Cannot retrieve current power status ($? $!)";
chomp($status);
logm("$status (want $onoff)");
$status =~ s/^Chassis Power is (on|off)$/$1/
@@ -66,7 +72,7 @@ sub pdu_power_state {
return;
}
- system_checked("$cmd power $onoff");
+ system_checked((@cmd, qw(power), $onoff));
my $count = 60;
for (;;) {
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |