Commit 74927055 authored by Mike Hibler's avatar Mike Hibler

Quote password string to avoid issues with special chars.

Also capture all ipmitool output for presenting to the caller.
parent c1fbd56d
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2003, 2006-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -103,9 +103,9 @@ sub new($$$;$) {
}
}
$self->{IPMICMD} = "$IPMITOOL -H $self->{DEVICENAME} -U $self->{USERNAME} -P $self->{PASSWORD}";
$self->{IPMICMD} = "$IPMITOOL -H $self->{DEVICENAME} -U $self->{USERNAME} -P '$self->{PASSWORD}'";
if ($self->{KGKEY}) {
$self->{IPMICMD} .= " -I lanplus -y $self->{KGKEY}";
$self->{IPMICMD} .= " -I lanplus -y '$self->{KGKEY}'";
} elsif ($self->{DEVICETYPE} eq "ipmi-ms") {
$self->{IPMICMD} .= " -I lanplus";
}
......@@ -216,7 +216,7 @@ sub _execipmicmd($$@) { # _ indicates that this is a private method (Perl conven
print STDERR "**** Executing $cmd\n"
if ($self->{DEBUG});
$output = `$cmd`; # get output of the $cmd, e.g. many lines of sensor readings or "Chassis power is on"
$output = `$cmd 2>&1`; # get output of the $cmd, e.g. many lines of sensor readings or "Chassis power is on"
chomp ( $output ); # remove the \n at the end, if any
print STDERR "impitool output:\n$output\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment