From 7e3c1b8b901bfacb592c44ac80ffe51ddd191833 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 3 Apr 2012 18:26:23 +0000 Subject: [PATCH] Add more neutral syntax for rspconfig account management of AMM, not everyone wants 'USERID' git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12106 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index b5bc0be52..ac55bff94 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -3977,7 +3977,7 @@ sub clicmds { my @unhandled; my %handled = (); my $result; - my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork solcfg USERID HMC); + my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork solcfg userpassword USERID HMC); # most of these commands should be able to be done # through SNMP, but they produce various errors. @@ -4096,7 +4096,8 @@ sub clicmds { elsif (/^rscanfsp$/) { $result = rscanfsp($t,$mpa,$handled{$_},$mm); } elsif (/^solcfg$/) { $result = solcfg($t,$handled{$_},$mm); } elsif (/^network_reset$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid,1); } - elsif (/^(USERID|HMC)$/) {$result = passwd($t, $mpa, $1, $handled{$_}, $mm);} + elsif (/^(USERID|HMC)$/) {$result = passwd($t, $mpa, $1, "=".$handled{$_}, $mm);} + elsif (/^userpassword$/) {$result = passwd($t, $mpa, $1, $handled{$_}, $mm);} push @data, "$_: @$result"; $Rc |= shift(@$result); push @cfgtext,@$result; @@ -4275,6 +4276,12 @@ sub passwd { my $user = shift; my $pass = shift; my $mm = shift; + if ($pass =~ /^=/) { + $pass=~ s/=//; + } elsif ($pass =~ /=/) { + ($user,$pass) = split /=/,$pass; + } + if (!$pass) { return ([1, "No param specified for '$user'"]); } @@ -4321,6 +4328,8 @@ sub passwd { return ([1, "Update password of HMC for '$fblades' failed. Please recreate the DFM connections for them."]); } } else { + #TODO: add new user if name mismatches what MM alread understands.. + #additionally, may have to delete USERID in this event @data = (); my $snmp_cmd = "users -n $user -ap sha -pp des -ppw $pass -T system:$mm"; @data = $t->cmd($snmp_cmd);