M #-: Delay vcenter driver requirement

(cherry picked from commit 55ff59774a)
This commit is contained in:
Tino Vazquez committed 2021-12-13 18:59:10 +01:00
1 parent e4ba5d70ed
commit cb2ae63d2e
1 file changed
+5 -1
@@ -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']