Possibility to upload image with custom parameters

This change adds:
 - The ability to upload image of cirros with specified "user",
"tenant" and "endpoint_type" variables.

Partial blueprint: detach-components-from-controllers

Change-Id: I0096544fa56e16cec735ec47df00b8fbba948549
This commit is contained in:
Dmitrii Kabanov 2015-07-01 01:40:48 -05:00
parent 29935efd3d
commit b192139d9a

View File

@ -7,12 +7,29 @@ hiera = Hiera.new(:config => '/etc/hiera.yaml')
test_vm_images = hiera.lookup 'test_vm_image', {}, {}
glanced = hiera.lookup 'glance', {} , {}
auth_addr = hiera.lookup 'internal_address', nil, {}
if glanced['tenant'].nil?
tenant_name = "services"
else
tenant_name = glanced['tenant']
end
ENV['OS_TENANT_NAME']="services"
ENV['OS_USERNAME']="glance"
if glanced['user'].nil?
user_name = "glance"
else
user_name = glanced['user']
end
if glanced['endpoint_type'].nil?
endpoint_type = "internalURL"
else
endpoint_type = glanced['endpoint_type']
end
ENV['OS_TENANT_NAME']="#{tenant_name}"
ENV['OS_USERNAME']="#{user_name}"
ENV['OS_PASSWORD']="#{glanced['user_password']}"
ENV['OS_AUTH_URL']="http://#{auth_addr}:5000/v2.0"
ENV['OS_ENDPOINT_TYPE'] = "internalURL"
ENV['OS_ENDPOINT_TYPE'] = "#{endpoint_type}"
raise 'Not test_vm_image data!' unless [Array, Hash].include?(test_vm_images.class) && test_vm_images.any?