mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
a1f13bb04f
Updates to the OpenStack server tests to get things running in *real* test mode. This patch also adds some useful helper functions which are now used to: -get the flavor ref for testing -get the image ref for testing -get the resize flavor ref for testing (defaults to flavor + 1) -disable password testing (not all hypervisors support this in OS)
37 lines
748 B
Ruby
37 lines
748 B
Ruby
class OpenStack
|
|
|
|
module Compute
|
|
|
|
module Formats
|
|
|
|
SUMMARY = {
|
|
'id' => String,
|
|
'name' => String,
|
|
'links' => Array
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def get_flavor_ref
|
|
compute = Fog::Compute[:openstack]
|
|
ENV['OPENSTACK_FLAVOR_REF'] || compute.list_flavors.body['flavors'].first['id']
|
|
end
|
|
|
|
def get_image_ref
|
|
compute = Fog::Compute[:openstack]
|
|
ENV['OPENSTACK_IMAGE_REF'] || compute.list_images.body['images'].first['id']
|
|
end
|
|
|
|
def get_flavor_ref_resize
|
|
# by default we simply add one to the default flavor ref
|
|
ENV['OPENSTACK_FLAVOR_REF_RESIZE'] || (get_flavor_ref.to_i + 1).to_s
|
|
end
|
|
|
|
def set_password_enabled
|
|
pw_enabled = ENV['OPENSTACK_SET_PASSWORD_ENABLED'] || "true"
|
|
return pw_enabled == "true"
|
|
end
|