Revision f7d34f2d

View differences:

share/onetoken/onetoken.sh
10 10
    shift
11 11

  
12 12
    if [ -z "$USER" -o "${USER:0:1}" = "-" ]; then
13
        echo "Usage: $0 <user> [options]" >&2
13
        echo "Usage: onetokenset <user> [options]" >&2
14 14
        echo "  Any option understood by 'oneuser token-set' is valid." >&2
15 15
        return 1
16 16
    fi
......
42 42
    USER=$1
43 43

  
44 44
    if [ -z "$USER" ]; then
45
        echo "Usage: $0 <user> [options]" >&2
45
        echo "Usage: onetokencreate <user> [options]" >&2
46 46
        echo "  Any option understood by 'oneuser token-create' is valid." >&2
47 47
        return 1
48 48
    fi
src/cli/oneuser
33 33

  
34 34
require 'uri'
35 35

  
36
cmd=CommandParser::CmdParser.new(ARGV) do
36
NO_CLIENT_CMDS = [ :key, :"token-create", :login ]
37

  
38
cmd = CommandParser::CmdParser.new(ARGV) do
37 39
    usage "`oneuser` <command> [<args>] [<options>]"
38 40
    version OpenNebulaHelper::ONE_VERSION
39 41

  
40 42
    helper = OneUserHelper.new
41 43

  
42 44
    before_proc do
43
        helper.set_client(options) if ![:key].include?(@comm_name)
45
        if !NO_CLIENT_CMDS.include?(@comm_name)
46
            begin
47
                helper.set_client(options)
48
            rescue Exception => e
49
                STDERR.puts e.message
50

  
51
                if e.message != "ONE_AUTH file not present"
52
                    STDERR.puts e.backtrace
53
                end
54

  
55
                exit 1
56
            end
57
        end
44 58
    end
45 59

  
46 60
    ########################################################################

Also available in: Unified diff