1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-26 10:03:37 +03:00

M #-: Delay vcenter driver requirement

This commit is contained in:
Tino Vazquez 2021-12-13 18:58:39 +01:00
parent 8baad6790e
commit 55ff59774a
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

View File

@ -15,7 +15,6 @@
#--------------------------------------------------------------------------- #
require 'opennebula/template_ext'
require 'vcenter_driver'
# Module to decorate VirtualMachine class with additional helpers not directly
# exposed through the OpenNebula XMLRPC API. The extensions include
@ -101,6 +100,11 @@ module OpenNebula::VirtualMachineExt
use_linked_clones = self['USER_TEMPLATE/VCENTER_LINKED_CLONES']
if use_linked_clones && use_linked_clones.downcase == 'yes'
# Delay the require until it is strictly needed
# This way we can avoid the vcenter driver dependency
# in no vCenter deployments
require 'vcenter_driver'
deploy_id = self['DEPLOY_ID']
vm_id = self['ID']
host_id = self['HISTORY_RECORDS/HISTORY[last()]/HID']