mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-15 05:57:23 +03:00
parent
e93530eff1
commit
10fd18d19c
@ -577,7 +577,23 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
||||
puts "Endpoint changed to \"#{zone['TEMPLATE/ENDPOINT']}\" in " <<
|
||||
"#{ENV['HOME']}/.one/one_endpoint"
|
||||
end
|
||||
return 0
|
||||
|
||||
return unless zone['TEMPLATE/ONEFLOW_ENDPOINT']
|
||||
|
||||
# Set ONEFLOW_ENDPOINT
|
||||
if temporary_zone
|
||||
puts "Type: export ONEFLOW_URL=#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}"
|
||||
else
|
||||
File.open(ENV['HOME'] + '/.one/oneflow_endpoint', 'w') do |f|
|
||||
f.puts zone['TEMPLATE/ONEFLOW_ENDPOINT']
|
||||
end
|
||||
|
||||
puts 'OneFlow Endpoint changed to ' \
|
||||
"\"#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}\" in " <<
|
||||
"#{ENV['HOME']}/.one/oneflow_endpoint"
|
||||
end
|
||||
|
||||
0
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -319,10 +319,21 @@ module Service
|
||||
|
||||
class Client
|
||||
def initialize(opts={})
|
||||
endpoint = '/.one/oneflow_endpoint'
|
||||
@username = opts[:username] || ENV['ONEFLOW_USER']
|
||||
@password = opts[:password] || ENV['ONEFLOW_PASSWORD']
|
||||
|
||||
url = opts[:url] || ENV['ONEFLOW_URL'] || 'http://localhost:2474'
|
||||
if opts[:url]
|
||||
url = opts[:url]
|
||||
elsif ENV['ONEFLOW_URL']
|
||||
url = ENV['ONEFLOW_URL']
|
||||
elsif ENV['HOME'] && File.exists?(ENV['HOME'] + endpoint)
|
||||
url = File.read(ENV['HOME'] + endpoint).strip
|
||||
elsif File.exists?('/var/lib/one/.one/oneflow_endpoint')
|
||||
url = File.read('/var/lib/one/.one/oneflow_endpoint').strip
|
||||
else
|
||||
url = 'http://localhost:2474'
|
||||
end
|
||||
|
||||
if @username.nil? && @password.nil?
|
||||
if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user