Sha256: 1f807f3a5e9e23d2aeac77ad0342c256976fc86d644e364b2c1398aed3fdcfdc
Contents?: true
Size: 1.72 KB
Versions: 73
Compression:
Stored size: 1.72 KB
Contents
module Fog module Compute class Vsphere class Real def list_server_types(filters={}) datacenter_name = filters[:datacenter] servertypes=raw_server_types(datacenter_name) if servertypes servertypes.map do | servertype | server_type_attributes(servertype, datacenter_name) end.compact else nil end #select{ | guestdesc | guestdesc.select{ | k, v | filter.has_key?(k) and filter[k] == v }==filter } end def raw_server_types(datacenter_name, filter={}) datacenter=find_raw_datacenter(datacenter_name) environmentBrowser=datacenter.hostFolder.childEntity.grep(RbVmomi::VIM::ComputeResource).first.environmentBrowser if environmentBrowser environmentBrowser.QueryConfigOption[:guestOSDescriptor] end end protected def server_type_attributes(servertype, datacenter) { :id => servertype.id, :name => servertype.id, :family => servertype.family, :fullname => servertype.fullName, :datacenter => datacenter, } end end class Mock def list_server_types(datacenter_name) [{:id=>"rhel6Guest", :name=>"rhel6Guest", :family=>"linuxGuest", :fullname=>"Red Hat Enterprise Linux 6 (32-Bit)", :datacenter=>"Solutions"}, {:id=>"rhel5_64Guest", :name=>"rhel5_64Guest", :family=>"linuxGuest", :fullname=>"Red Hat Enterprise Linux 5 (64-Bit)", :datacenter=>"Solutions"}] end end end end end
Version data entries
73 entries across 73 versions & 5 rubygems