2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-14 15:20:29 +00:00

add default sshusername if not exists for config_snmp

This commit is contained in:
Casandra Qiu
2016-10-18 22:17:36 -04:00
parent 677be49c7e
commit e0ddd7cb96

View File

@@ -243,6 +243,12 @@ sub config_snmp {
my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','username','password','auth']);
foreach my $switch (@nodes) {
my $user = $switchhash->{$switch}->[0]->{sshusername};
if (!$user) {
print "switch ssh username is not defined, add default one\n";
$cmd = "chdef $switch username=admin";
$rc= xCAT::Utils->runcmd($cmd, 0);
$user="admin";
}
if ($::USER) {
$snmp_user = $::USER;
} elsif ($switchhash->{$switch}->[0]->{username}) {