From 31b06c29efc7c28f9ed8c63f40c83b7c72ece2ea Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 3 Jun 2015 15:39:00 -0400 Subject: [PATCH] more on using passwd table for username/pasword for swithches --- perl-xCAT/xCAT/DSHCLI.pm | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index b921e4307..b2465fdc9 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -1007,21 +1007,24 @@ sub fork_fanout_dsh my $switchents = $switchestab->getNodesAttribs($targets_waiting,[qw/switch sshusername sshpassword protocol/]); foreach my $entry (values %$switchents) { my $switch=$entry->[0]->{switch}; - my $username = "admin"; + my $username; my $password; my $protocol; - if (defined($entry->[0]->{sshusername})) { #use switch table first + # use switches table first + if (defined($entry->[0]->{sshusername})) { $username = $entry->[0]->{sshusername}; - if (defined($entry->[0]->{sshpassword})) { - $password = $entry->[0]->{sshpassword}; - } - if (defined($entry->[0]->{protocol})) { - $protocol = $entry->[0]->{protocol}; - } - } - elsif (defined($passwd_ent[0]->{username})) { #use passwd table as default - $username=$passwd_ent[0]->{username}; + } + if (defined($entry->[0]->{sshpassword})) { + $password = $entry->[0]->{sshpassword}; + } + if (defined($entry->[0]->{protocol})) { + $protocol = $entry->[0]->{protocol}; + } + if ((!$username) && (!$password) && (!$protocol)) { #use passwd table as default + if (defined($passwd_ent[0]->{username})) { + $username=$passwd_ent[0]->{username}; + } if (defined($passwd_ent[0]->{password})) { $password = $passwd_ent[0]->{password}; }