Sha256: 0875cc044b5aefc8cde48262a7f52da472b3ab4e83e919bc328eb8096dc4e87b
Contents?: true
Size: 966 Bytes
Versions: 26
Compression:
Stored size: 966 Bytes
Contents
module Fog module Compute class Vsphere class Real def datacenters @datacenters ||= datacenters_reload # Hide the values which are the RbVmomi instances @datacenters.keys end private def datacenters_reload @rootfolder ||= @connection.rootFolder inventory = @rootfolder.inventory(:Datacenter => [ 'name' ])[@rootfolder] # Convert the inventory into a Hash of the form: We remove the # property selectors. { "<dc_name>" => #<RbVmomi::VIM::Datacenter> } # The Datacenter instance itself is at index 0 and the properties we # collected are at index 1. inventory.inject({}) do |memo, (name,dc_ary)| memo[name] = dc_ary[0] memo end end end class Mock def datacenters [ "Solutions", "Solutions2", "Solutions3" ] end end end end end
Version data entries
26 entries across 26 versions & 10 rubygems