Show auth token if it cannot be written to ONE_AUTH

This commit is contained in:
Ruben S. Montero committed 2014-10-10 10:26:13 +02:00
1 parent 2a896ace1a
commit de66bded58
1 file changed
+8 -7
+8 -7
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.
#-----------------------------------------------------------------------