module OVH::Provisioner
Main module
Load configuration and initialize client
Define version
Constants
- VERSION
Attributes
client[R]
config[R]
logger[RW]
spawner[R]
Public Class Methods
check_missing(config)
click to toggle source
# File lib/ovh/provisioner/init.rb, line 47 def check_missing(config) missing = %w[ app_key app_secret consumer_key api_url ].map { |key| config[key].nil? ? key : nil }.compact return config if missing.empty? puts "Please provide valid #{missing.join(', ')}" exit 1 end
create_client()
click to toggle source
# File lib/ovh/provisioner/init.rb, line 58 def create_client return @client unless @client.nil? OVH::REST.new( config['app_key'], config['app_secret'], config['consumer_key'], config['api_url'] ) end
create_spawner()
click to toggle source
# File lib/ovh/provisioner/init.rb, line 69 def create_spawner return @spawner unless @spawner.nil? spawner = Spawner.new Celluloid::Actor[Spawner::NAME] = spawner end
init(options)
click to toggle source
# File lib/ovh/provisioner/init.rb, line 30 def init(options) @config = load_config(options) @client = create_client @spawner = create_spawner end
load_config(options)
click to toggle source
# File lib/ovh/provisioner/init.rb, line 36 def load_config(options) config_file = options['config_file'] begin config = YAML.load_file config_file if File.exist? config_file rescue StandardError => e puts "#{e}\nCould not load configuration file: #{config_file}" exit 1 end check_missing((config || {}).merge(options)) end
start()
click to toggle source
# File lib/ovh/provisioner.rb, line 31 def start OVH::Provisioner::Cli.start(ARGV) rescue StandardError => error puts error.message puts error.backtrace exit 1 end