From b9b5d8ffe06ee8fbc301fc1daf02f7d6e00e882c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantino=20V=C3=A1zquez=20Blanco?= Date: Fri, 9 Oct 2009 16:06:18 +0000 Subject: [PATCH] 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 --- src/cloud/ec2/lib/EC2QueryClient.rb | 4 ++-- src/cloud/occi/lib/ONEOCCIClient.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cloud/ec2/lib/EC2QueryClient.rb b/src/cloud/ec2/lib/EC2QueryClient.rb index 92bce3936e..ff38c28d84 100644 --- a/src/cloud/ec2/lib/EC2QueryClient.rb +++ b/src/cloud/ec2/lib/EC2QueryClient.rb @@ -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" diff --git a/src/cloud/occi/lib/ONEOCCIClient.rb b/src/cloud/occi/lib/ONEOCCIClient.rb index 5fe2388a45..092fcd2bb1 100755 --- a/src/cloud/occi/lib/ONEOCCIClient.rb +++ b/src/cloud/occi/lib/ONEOCCIClient.rb @@ -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"