mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #795: Use yaml conf file in OCCI
This commit is contained in:
parent
2be5ec5694
commit
3276069da2
@ -77,8 +77,8 @@ class VirtualMachineOCCI < VirtualMachine
|
||||
if @vm_info != nil
|
||||
itype = @vm_info['INSTANCE_TYPE']
|
||||
|
||||
if itype != nil and types[itype] != nil
|
||||
@template = base + "/#{types[itype]['TEMPLATE']}"
|
||||
if itype != nil and types[itype.to_sym] != nil
|
||||
@template = base + "/#{types[itype.to_sym][:template]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -45,34 +45,34 @@ require 'rubygems'
|
||||
require 'sinatra'
|
||||
|
||||
require 'OCCIServer'
|
||||
require 'Configuration'
|
||||
|
||||
include OpenNebula
|
||||
|
||||
##############################################################################
|
||||
# Parse Configuration file
|
||||
##############################################################################
|
||||
begin
|
||||
config = Configuration.new(CONFIGURATION_FILE)
|
||||
config.add_configuration_value("TEMPLATE_LOCATION", TEMPLATE_LOCATION)
|
||||
|
||||
instance_types = CloudServer.get_instance_types(config)
|
||||
config.add_configuration_value("INSTANCE_TYPES", instance_types)
|
||||
|
||||
CloudServer.print_configuration(config)
|
||||
|
||||
set :config, config
|
||||
conf = YAML.load_file(CONFIGURATION_FILE)
|
||||
rescue Exception => e
|
||||
puts "Error starting server: #{e}"
|
||||
exit(-1)
|
||||
puts "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
conf[:template_location] = TEMPLATE_LOCATION
|
||||
|
||||
CloudServer.print_configuration(conf)
|
||||
|
||||
##############################################################################
|
||||
# Sinatra Configuration
|
||||
##############################################################################
|
||||
set :config, conf
|
||||
|
||||
if CloudServer.is_port_open?(settings.config[:server],
|
||||
settings.config[:port])
|
||||
puts "Port busy, please shutdown the service or move occi server port."
|
||||
exit
|
||||
end
|
||||
|
||||
##############################################################################
|
||||
# Sinatra Configuration
|
||||
##############################################################################
|
||||
set :host, settings.config[:server]
|
||||
set :port, settings.config[:port]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user