mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
Print out error msg for xcatprobe switch_macmap command if switch passwordless is not enabled (#5064)
* Print out error msg for xcatprobe switch_mac command if switch passwordless is not enabled. * Modified msg only if in the collect_mac_info case
This commit is contained in:
parent
ad1c597eba
commit
fe249bfb70
@ -356,7 +356,7 @@ sub dump_mac_info {
|
||||
$ret{$switch}->{ErrorStr} = $self->{macinfo}->{$switch}->{ErrorStr};
|
||||
|
||||
# To show the error message that the username/password related error is for SNMP only
|
||||
if ($ret{$switch}->{ErrorStr} =~ /user\s*name|password/i) {
|
||||
if ($ret{$switch}->{ErrorStr} =~ /user\s*name|password$/i) {
|
||||
$ret{$switch}->{ErrorStr} .= " through SNMP";
|
||||
}
|
||||
} else {
|
||||
@ -729,6 +729,11 @@ sub refresh_switch {
|
||||
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);
|
||||
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}) {
|
||||
my $errmsg = "Failed to get MAC table from $switch. Make sure passwordless SSH to the switch is enabled.";
|
||||
$self->{macinfo}->{$switch}->{ErrorStr} = $errmsg;
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
foreach (@res){
|
||||
if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) vlan ([0-9]+) .*/){
|
||||
|
Loading…
x
Reference in New Issue
Block a user