mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-21 09:33:53 +03:00
B #5236: oneuser token-create does not work without ONE_AUTH
This commit is contained in:
parent
459265e1f0
commit
f7d34f2dc7
@ -10,7 +10,7 @@ onetokenset(){
|
||||
shift
|
||||
|
||||
if [ -z "$USER" -o "${USER:0:1}" = "-" ]; then
|
||||
echo "Usage: $0 <user> [options]" >&2
|
||||
echo "Usage: onetokenset <user> [options]" >&2
|
||||
echo " Any option understood by 'oneuser token-set' is valid." >&2
|
||||
return 1
|
||||
fi
|
||||
@ -42,7 +42,7 @@ onetokencreate(){
|
||||
USER=$1
|
||||
|
||||
if [ -z "$USER" ]; then
|
||||
echo "Usage: $0 <user> [options]" >&2
|
||||
echo "Usage: onetokencreate <user> [options]" >&2
|
||||
echo " Any option understood by 'oneuser token-create' is valid." >&2
|
||||
return 1
|
||||
fi
|
||||
|
@ -33,14 +33,28 @@ require 'one_helper/onequota_helper'
|
||||
|
||||
require 'uri'
|
||||
|
||||
cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
NO_CLIENT_CMDS = [ :key, :"token-create", :login ]
|
||||
|
||||
cmd = CommandParser::CmdParser.new(ARGV) do
|
||||
usage "`oneuser` <command> [<args>] [<options>]"
|
||||
version OpenNebulaHelper::ONE_VERSION
|
||||
|
||||
helper = OneUserHelper.new
|
||||
|
||||
before_proc do
|
||||
helper.set_client(options) if ![:key].include?(@comm_name)
|
||||
if !NO_CLIENT_CMDS.include?(@comm_name)
|
||||
begin
|
||||
helper.set_client(options)
|
||||
rescue Exception => e
|
||||
STDERR.puts e.message
|
||||
|
||||
if e.message != "ONE_AUTH file not present"
|
||||
STDERR.puts e.backtrace
|
||||
end
|
||||
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
########################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user