From 489ee67c6a872b9cbf3390a80bb4e98dd78ba367 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Sep 2017 21:32:17 -0400 Subject: [PATCH] Oneclipasu (#4020) * Filter out extraneous output of OneCli * Remove extraneous content from pasu * Update pasu filtering * Fix recognizing success to filter * Update for new Lenovo OneCLI rpm The new packaging offers up iflash64 and asu in a consistent location. * Workaround different IPv6 syntax for asu/onecli * Filter out header of new version of OneCLI * Filter out the Invoking SET command output of onecli --- xCAT-client/bin/pasu | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/xCAT-client/bin/pasu b/xCAT-client/bin/pasu index 4139f00de..08b77e746 100755 --- a/xCAT-client/bin/pasu +++ b/xCAT-client/bin/pasu @@ -23,13 +23,24 @@ use Getopt::Long; use POSIX qw(:signal_h :errno_h :sys_wait_h); use Thread qw(yield); + +$::onecli = 0; if ($iam =~ /pasu/) { - $::utilcmd = '/opt/lenovo/toolscenter/asu/asu64'; + $::utilcmd = '/opt/lenovo/onecli/asu'; + $::onecli = 1; + if (!-x $::utilcmd) { + $::onecli = 0; + $::utilcmd = '/opt/lenovo/toolscenter/asu/asu64'; + } if (!-x $::utilcmd) { $::utilcmd = '/opt/ibm/toolscenter/asu/asu64'; } } elsif ($iam =~ /piflash/) { - $::utilcmd = '/opt/xcat/sbin/iflash64 --unattended'; + $::utilcmd = '/opt/lenovo/onecli/iflash64'; + if (!-x $::utilcmd) { + $::utilcmd = '/opt/xcat/sbin/iflash64'; + } + $::utilcmd .= ' --unattended' } my $interface; my $username; @@ -198,7 +209,17 @@ sub processoutput { #This way, one arbiter handles output, no interrupting $line !~ /Licensed Materials - Property of Lenovo/i && $line !~ /\(C\) Copyright IBM Corp. \d+-\d+ All Rights Reserved/i && $line !~ /\(C\) Copyright Lenovo Corp. \d+-\d+ All Rights Reserved/i && - $line !~ /Connected to IMM at IP address/i)) { + $line !~ /Connected to IMM at IP address/i && + $line !~ /Lenovo ASU/i && + $line !~ /^\s*$/i && + $line !~ /Lenovo ToolsCenterSuite CLI/i && + $line !~ /Lenovo XClarity Essentials OneCLI/i && + $line !~ /Invoking SHOW command .../i && + $line !~ /Invoking SET command .../i && + $line !~ /Connected to BMC by IP address/i && + $line !~ /Succeeded running the command /i && + $line !~ /Based on module version /i && + $line !~ /Succeed running command /i)) { print $nodehdl{$readyh} . ": " . $line . "\n"; } } @@ -225,6 +246,9 @@ sub utilnode { } else { foreach my $a (@_) { $args .= ' ' . xCAT::Utils->quote($a); } } + if ($::onecli and $bmc =~ /:/) { + $bmc = "[$bmc]"; + } my $cmd = "$::utilcmd $args --host '$bmc' --user '$username' --password '$passwd' 2>&1 |"; if ($::VERBOSE) { print "forking $cmd\n"; } my $pid = open($$out, $cmd);