Sha256: 78a67822f63195628644179384edd37185edfdb53d0c3725f2f5cdec9d8ac879
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
module Fog module Compute class Vsphere class Real def list_groups(filters = {}) cluster = get_raw_cluster(filters[:cluster], filters[:datacenter]) cluster.configurationEx.group.map { |g| group_attributes g, filters } end protected def group_attributes(group, filters) attributes = {} attributes[:datacenter] = filters[:datacenter] attributes[:cluster] = filters[:cluster] attributes[:name] = group[:name] attributes[:type] = group.class if group.class.to_s == 'ClusterVmGroup' then attributes[:vm_ids] = group[:vm].map { |vm| vm.config.instanceUuid } end if group.class.to_s == 'ClusterHostGroup' then attributes[:hosts] = group[:host].map(&:name) end attributes end end class Mock def list_groups(filters = {}) data[:groups].values.select { |g| g[:datacenter] == filters[:datacenter] && g[:cluster] == filters[:cluster] } end end end end end
Version data entries
7 entries across 5 versions & 2 rubygems