Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyvimomi missing #18190

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 5 additions & 10 deletions contrib/inventory/vmware_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
from six.moves import configparser
from time import time

HAS_PYVMOMI = False
try:
from pyVmomi import vim
from pyVim.connect import SmartConnect, Disconnect
HAS_PYVMOMI = True
except ImportError:
pass
sys.exit("ERROR: This inventory script requires the 'pyVmomi' python library and it was not able to load it.")

try:
import json
Expand Down Expand Up @@ -100,13 +98,10 @@ class VMWareInventory(object):
'childtype']

# translation table for attributes to fetch for known vim types
if not HAS_PYVMOMI:
vimTable = {}
else:
vimTable = {
vim.Datastore: ['_moId', 'name'],
vim.ResourcePool: ['_moId', 'name'],
}
vimTable = {
vim.Datastore: ['_moId', 'name'],
vim.ResourcePool: ['_moId', 'name'],
}

def _empty_inventory(self):
return {"_meta" : {"hostvars" : {}}}
Expand Down