Skip to content

Commit

Permalink
Import pyVmomi like in module_utils/vmware.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolenz committed Jun 23, 2021
1 parent 4196beb commit 070f248
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/module_utils/vm_device_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,26 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type

from pyVmomi import vim
from random import randint
from ansible.module_utils.common.network import is_mac

PYVMOMI_IMP_ERR = None
try:
from pyVmomi import vim
HAS_PYVMOMI = True
except ImportError:
PYVMOMI_IMP_ERR = traceback.format_exc()
HAS_PYVMOMI = False


class PyVmomiDeviceHelper(object):
""" This class is a helper to create easily VMware Objects for PyVmomiHelper """

def __init__(self, module):
if not HAS_PYVMOMI:
module.fail_json(msg=missing_required_lib('PyVmomi'),
exception=PYVMOMI_IMP_ERR)

self.module = module
# This is not used for the multiple controller with multiple disks scenario,
# disk unit number can not be None
Expand Down

0 comments on commit 070f248

Please sign in to comment.