1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Generate password from options for the passwd command

This commit is contained in:
Daniel Molina 2011-08-30 12:33:54 +02:00
parent 1c875dd438
commit 93c133b181

View File

@ -189,9 +189,21 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Changes the given User's password
EOT
command :passwd, passwd_desc, :userid, :password do
command :passwd, passwd_desc, :userid, :password,
:options=>create_options do
if options[:ssh] or options[:x509]
rc = helper.password(options)
if rc.first == 0
pass = rc[1]
else
exit_with_code *rc
end
else
pass = args[1]
end
helper.perform_action(args[0],options,"Password changed") do |user|
user.passwd(args[1])
user.passwd(pass)
end
end