Bug #4196: Copy one_auth initialization from client.rb

(cherry picked from commit 1cc56deab1)
This commit is contained in:
Carlos Martín committed 2015-11-26 16:18:53 +01:00
1 parent 51c43b80b8
commit ef6fe4a3bb
1 file changed
+6 -2
+6 -2
View File
@@ -307,11 +307,15 @@ module Service
if @username.nil? && @password.nil?
if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
one_auth = File.read(ENV["ONE_AUTH"])
elsif File.file?(ENV["HOME"]+"/.one/one_auth")
elsif ENV["HOME"] and File.file?(ENV["HOME"]+"/.one/one_auth")
one_auth = File.read(ENV["HOME"]+"/.one/one_auth")
elsif File.file?("/var/lib/one/.one/one_auth")
one_auth = File.read("/var/lib/one/.one/one_auth")
else
raise "ONE_AUTH file not present"
end
one_auth.rstrip!
one_auth = one_auth.rstrip
@username, @password = one_auth.split(':')
end