2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

Merge pull request #7464 from stanford-rc/onie_macmap

Fix for getting MAC table over SSH on recent ONIE switches
This commit is contained in:
Markus Hilger 2024-08-09 23:17:51 +02:00 committed by GitHub
commit 1534231ae7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -723,7 +723,7 @@ sub refresh_switch {
my $mymac;
my $myport;
my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch 'bridge fdb show|grep -i -v permanent|tr A-Z a-z 2>/dev/null' 2>/dev/null",-1);
my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch \"bash -lc 'set -o pipefail; bridge fdb show |grep -i -v permanent |tr A-Z a-z 2>/dev/null'\" 2>/dev/null",-1);
if ($::RUNCMD_RC) {
xCAT::MsgUtils->message("S", "Failed to get mac table with ssh to $switch, fall back to snmp! To obtain mac table with ssh, please make sure the passwordless root ssh to $switch is available");
if ($self->{collect_mac_info}) {
@ -774,6 +774,7 @@ sub refresh_switch {
}
}
my $session = $self->getsnmpsession('community' => $community, 'switch' => $switch);
unless ($session) {
xCAT::MsgUtils->message("S", "Failed to communicate with $switch");