class VagrantPlugins::Openstack::HeatClient
Public Class Methods
new()
click to toggle source
# File lib/vagrant-openstack-provider/client/heat.rb, line 14 def initialize @logger = Log4r::Logger.new('vagrant_openstack::glance') @session = VagrantPlugins::Openstack.session end
Public Instance Methods
create_stack(env, options)
click to toggle source
# File lib/vagrant-openstack-provider/client/heat.rb, line 19 def create_stack(env, options) stack = {}.tap do |s| s['stack_name'] = options[:name] if options[:name] s['template'] = options[:template] end stack_res = post(env, "#{@session.endpoints[:orchestration]}/stacks", stack.to_json) JSON.parse(stack_res)['stack']['id'] end
delete_stack(env, stack_name, stack_id)
click to toggle source
# File lib/vagrant-openstack-provider/client/heat.rb, line 35 def delete_stack(env, stack_name, stack_id) stack_exists do delete(env, "#{@session.endpoints[:orchestration]}/stacks/#{stack_name}/#{stack_id}") end end
get_stack_details(env, stack_name, stack_id)
click to toggle source
# File lib/vagrant-openstack-provider/client/heat.rb, line 28 def get_stack_details(env, stack_name, stack_id) stack_exists do server_details = get(env, "#{@session.endpoints[:orchestration]}/stacks/#{stack_name}/#{stack_id}") JSON.parse(server_details)['stack'] end end
stack_exists() { || ... }
click to toggle source
# File lib/vagrant-openstack-provider/client/heat.rb, line 41 def stack_exists return yield rescue Errors::VagrantOpenstackError => e raise Errors::StackNotFound if e.extra_data[:code] == 404 raise e end