cancel_update(_)
click to toggle source
def cancel_update(_)
response = Excon::Response.new
response.status = 200
response.body = {}
response
end
create_stack(arg1, arg2 = nil)
click to toggle source
def create_stack(arg1, arg2 = nil)
if arg1.kind_of?(Hash)
options = arg1
else
Fog::Logger.deprecation("#create_stack(stack_name, options) is deprecated, use #create_stack(options) instead [light_black](#{caller.first})[/]")
options = {
:stack_name => arg1
}.merge(arg2.nil? ? {} : arg2)
end
stack_id = Fog::Mock.random_hex(32)
stack = data[:stacks][stack_id] = {
'id' => stack_id,
'stack_name' => options[:stack_name],
'links' => [],
'description' => options[:description],
'stack_status' => 'CREATE_COMPLETE',
'stack_status_reason' => 'Stack successfully created',
'creation_time' => Time.now,
'updated_time' => Time.now
}
response = Excon::Response.new
response.status = 201
response.body = {
'id' => stack_id,
'links' => [{"href" => "http://localhost:8004/v1/fake_tenant_id/stacks/#{options[:stack_name]}/#{stack_id}", "rel" => "self"}]
}
if options.key?(:files)
response.body['files'] = {'foo.sh' => 'hello'}
end
if options.key?(:template) || options.key?(:template_url)
file_resolver = Util::RecursiveHotFileLoader.new(options[:template] || options[:template_url], options[:files])
response.body['files'] = file_resolver.files unless file_resolver.files.empty?
end
response
end
credentials()
click to toggle source
def credentials
{:provider => 'openstack',
:openstack_auth_url => @openstack_auth_uri.to_s,
:openstack_auth_token => @auth_token,
:openstack_management_url => @openstack_management_url,
:openstack_identity_endpoint => @openstack_identity_public_endpoint}
end
data()
click to toggle source
def data
self.class.data["#{@openstack_username}-#{@current_tenant}"]
end
delete_stack(arg1, arg2 = nil)
click to toggle source
def delete_stack(arg1, arg2 = nil)
if arg1.kind_of?(Stack)
stack = arg1
stack_name = stack.stack_name
stack_id = stack.id
else
Fog::Logger.deprecation("#delete_stack(stack_name, stack_id) is deprecated, use #delete_stack(stack) instead [light_black](#{caller.first})[/]")
stack_name = arg1
stack_id = arg2
end
data[:stacks].delete(stack_id)
response = Excon::Response.new
response.status = 204
response.body = {}
response
end
get_stack_template(stack)
click to toggle source
def get_stack_template(stack)
end
list_events(_options = {})
click to toggle source
def list_events(_options = {})
events = data[:events].values
Excon::Response.new(
:body => {'events' => events},
:status => 200
)
end
list_resource_events(_stack, _resource, _options = {})
click to toggle source
def list_resource_events(_stack, _resource, _options = {})
events = data[:events].values
Excon::Response.new(
:body => {'events' => events},
:status => 200
)
end
list_resource_types()
click to toggle source
def list_resource_types
resources = data[:resource_types].values
Excon::Response.new(
:body => {'resource_types' => resources},
:status => 200
)
end
list_resources(_options = {}, _options_deprecated = {})
click to toggle source
def list_resources(_options = {}, _options_deprecated = {})
resources = data[:resources].values
Excon::Response.new(
:body => {'resources' => resources},
:status => 200
)
end
list_stack_data(_options = {})
click to toggle source
def list_stack_data(_options = {})
stacks = data[:stacks].values
Excon::Response.new(
:body => {'stacks' => stacks},
:status => 200
)
end
list_stack_data_detailed(_options = {})
click to toggle source
def list_stack_data_detailed(_options = {})
Excon::Response.new(
:body => {
'stacks' =>
[{"parent" => nil,
"disable_rollback" => true,
"description" => "No description",
"links" => [{"href" => "http://192.0.2.1:8004/v1/ae084f19a7974d5b95703f633e57fd64/stacks/overcloud/9ea5226f-0bb3-40bf-924b-f89ea11bb69c",
"rel" => "self"}],
"stack_status_reason" => "Stack CREATE completed successfully",
"stack_name" => "overcloud",
"stack_user_project_id" => "ae084f19a7974d5b95703f633e57fd64",
"stack_owner" => "admin",
"creation_time" => "2015-06-24T07:19:01Z",
"capabilities" => [],
"notification_topics" => [],
"updated_time" => nil,
"timeout_mins" => nil,
"stack_status" => "CREATE_COMPLETE",
"parameters" => {"Controller-1::SSLKey" => "******",
"Compute-1::RabbitClientUseSSL" => "False",
"Controller-1::KeystoneSSLCertificate" => "",
"Controller-1::CinderLVMLoopDeviceSize" => "5000"},
"id" => "9ea5226f-0bb3-40bf-924b-f89ea11bb69c",
"outputs" => [],
"template_description" => "No description"}]
},
:status => 200
)
end
list_stack_events(_stack, _options = {})
click to toggle source
def list_stack_events(_stack, _options = {})
events = data[:events].values
Excon::Response.new(
:body => {'events' => events},
:status => 200
)
end
patch_stack(_stack, _options = {})
click to toggle source
def patch_stack(_stack, _options = {})
response = Excon::Response.new
response.status = 202
response.body = {}
response
end
reset_data()
click to toggle source
def reset_data
self.class.data.delete("#{@openstack_username}-#{@current_tenant}")
end
show_event_details(_stack, _event)
click to toggle source
def show_event_details(_stack, _event)
events = data[:events].values
Excon::Response.new(
:body => {'events' => events},
:status => 200
)
end
show_resource_data(_stack_name, _stack_id, _resource_name)
click to toggle source
def show_resource_data(_stack_name, _stack_id, _resource_name)
resources = data[:resources].values
Excon::Response.new(
:body => {'resources' => resources},
:status => 200
)
end
show_resource_template(name)
click to toggle source
def show_resource_template(name)
end
show_stack_details(_name, _id)
click to toggle source
def show_stack_details(_name, _id)
stack = data[:stack].values
Excon::Response.new(
:body => {'stack' => stack},
:status => 200
)
end
update_stack(arg1, arg2 = nil, arg3 = nil)
click to toggle source
def update_stack(arg1, arg2 = nil, arg3 = nil)
if arg1.kind_of?(Stack)
stack = arg1
stack_name = stack.stack_name
stack_id = stack.id
options = arg2.nil? ? {} : arg2
else
Fog::Logger.deprecation("#update_stack(stack_id, stack_name, options) is deprecated, use #update_stack(stack, options) instead [light_black](#{caller.first})[/]")
stack_id = arg1
stack_name = arg2
options = {
:stack_name => stack_name
}.merge(arg3.nil? ? {} : arg3)
end
if options.key?(:files)
response.body['files'] = {'foo.sh' => 'hello'}
end
if options.key?(:template) || options.key?(:template_url)
file_resolver = Util::RecursiveHotFileLoader.new(options[:template] || options[:template_url], options[:files])
response.body['files'] = file_resolver.files unless file_resolver.files.empty?
end
response = Excon::Response.new
response.status = 202
response.body = {}
response
end