Avoid error when setting ONE_AUTH to a directory. For #140

git-svn-id: http://svn.opennebula.org/one/trunk@829 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Constantino Vázquez Blanco committed 2009-10-09 16:06:18 +00:00
1 parent 32409a65e1
commit b9b5d8ffe0
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -44,9 +44,9 @@ module EC2QueryClient
ec2auth = secret
elsif ENV["EC2_ACCESS_KEY"] and ENV["EC2_SECRET_KEY"]
ec2auth = ENV["EC2_ACCESS_KEY"] + ":" + ENV["EC2_SECRET_KEY"]
elsif ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.exists?(ENV["ONE_AUTH"])
elsif ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
ec2auth=File.read(ENV["ONE_AUTH"])
elsif File.exists?(ENV["HOME"]+"/.one/one_auth")
elsif File.file?(ENV["HOME"]+"/.one/one_auth")
ec2auth=File.read(ENV["HOME"]+"/.one/one_auth")
else
raise "No authorization data present"
+2 -2
View File
@@ -44,9 +44,9 @@ module ONEOCCIClient
# Autentication
if user && pass
@occiauth = user + ":" + Digest::SHA1.hexdigest(pass)
elsif ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.exists?(ENV["ONE_AUTH"])
elsif ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
one_auth=File.read(ENV["ONE_AUTH"])
elsif File.exists?(ENV["HOME"]+"/.one/one_auth")
elsif File.file?(ENV["HOME"]+"/.one/one_auth")
one_auth=File.read(ENV["HOME"]+"/.one/one_auth")
else
raise "No authorization data present"