1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-01 05:47:01 +03:00

Show auth token if it cannot be written to ONE_AUTH

This commit is contained in:
Ruben S. Montero 2014-09-13 15:40:19 +02:00
parent 2a896ace1a
commit de66bded58

View File

@ -158,13 +158,6 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
auth = TokenAuth.new() #oned generated token
end
#-----------------------------------------------------------------------
# Check that ONE_AUTH target can be written
#-----------------------------------------------------------------------
if File.file?(ONE_AUTH) && !options[:force]
return -1, "File #{ONE_AUTH} exists, use --force to overwrite"
end
#-----------------------------------------------------------------------
# Authenticate with oned using the token/passwd and set/generate the
# authentication token for the user
@ -178,6 +171,14 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
return -1, token_oned.message if OpenNebula.is_error?(token_oned)
#-----------------------------------------------------------------------
# Check that ONE_AUTH target can be written
#-----------------------------------------------------------------------
if File.file?(ONE_AUTH) && !options[:force]
return 0, "File #{ONE_AUTH} exists, use --force to overwrite."\
"\nAuthentication Token is:\n#{username}:#{token_oned}"
end
#-----------------------------------------------------------------------
# Store the token in ONE_AUTH.
#-----------------------------------------------------------------------