mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #595: moved read_configuration to OpenNebulaDriver
This commit is contained in:
parent
c2ec359873
commit
48c20f57a2
@ -177,40 +177,6 @@ class ActionManager
|
||||
|
||||
private
|
||||
|
||||
def read_configuration
|
||||
one_config=nil
|
||||
|
||||
if ENV['ONE_LOCATION']
|
||||
one_config=ENV['ONE_LOCATION']+'/var/config'
|
||||
else
|
||||
one_config='/var/lib/one/config'
|
||||
end
|
||||
|
||||
config=Hash.new
|
||||
cfg=''
|
||||
|
||||
begin
|
||||
open(one_config) do |file|
|
||||
cfg=file.read
|
||||
end
|
||||
|
||||
cfg.split(/\n/).each do |line|
|
||||
m=line.match(/^([^=]+)=(.*)$/)
|
||||
|
||||
if m
|
||||
name=m[1].strip.upcase
|
||||
value=m[2].strip
|
||||
config[name]=value
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
STDERR.puts "Error reading config: #{e.inspect}"
|
||||
STDERR.flush
|
||||
end
|
||||
|
||||
config
|
||||
end
|
||||
|
||||
def delete_running_action(action_id)
|
||||
@action_running.delete(action_id)
|
||||
end
|
||||
|
@ -279,6 +279,40 @@ private
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def read_configuration
|
||||
one_config=nil
|
||||
|
||||
if ENV['ONE_LOCATION']
|
||||
one_config=ENV['ONE_LOCATION']+'/var/config'
|
||||
else
|
||||
one_config='/var/lib/one/config'
|
||||
end
|
||||
|
||||
config=Hash.new
|
||||
cfg=''
|
||||
|
||||
begin
|
||||
open(one_config) do |file|
|
||||
cfg=file.read
|
||||
end
|
||||
|
||||
cfg.split(/\n/).each do |line|
|
||||
m=line.match(/^([^=]+)=(.*)$/)
|
||||
|
||||
if m
|
||||
name=m[1].strip.upcase
|
||||
value=m[2].strip
|
||||
config[name]=value
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
STDERR.puts "Error reading config: #{e.inspect}"
|
||||
STDERR.flush
|
||||
end
|
||||
|
||||
config
|
||||
end
|
||||
end
|
||||
|
||||
################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user