lib/rbvmomi/vim/HostSystem.rb in rbvmomi-1.4.0 vs lib/rbvmomi/vim/HostSystem.rb in rbvmomi-1.5.0

- old
+ new

@@ -4,10 +4,22 @@ def esxcli @cached_esxcli ||= VIM::EsxcliNamespace.root(self) end def dtm - @cached_dtm ||= RetrieveDynamicTypeManager() + @cached_dtm ||= begin + RetrieveDynamicTypeManager() + rescue VIM::MethodNotFound + if summary.config.product.version >= '4.1.0' + if summary.config.product.version < '5.0.0' and direct? + VIM::InternalDynamicTypeManager(_connection, 'ha-dynamic-type-manager') + else + raise "esxcli not supported through VC before 5.0.0" + end + else + raise "esxcli not supported before 4.1.0" + end + end end def dti @cached_dti ||= dtm.DynamicTypeMgrQueryTypeInfo end