VMware: remove unused imports (#43804)

Idea taken from https://github.com/ansible/ansible/pull/43402

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/36818/merge
Abhijeet Kasurde 6 years ago committed by GitHub
parent 1decbb92fc
commit e364d717cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,7 +9,7 @@
# TODO: # TODO:
# * more jq examples # * more jq examples
# * optional folder heriarchy # * optional folder hierarchy
""" """
$ jq '._meta.hostvars[].config' data.json | head $ jq '._meta.hostvars[].config' data.json | head
@ -38,9 +38,8 @@ import sys
import uuid import uuid
from time import time from time import time
import six
from jinja2 import Environment from jinja2 import Environment
from six import integer_types, string_types from six import integer_types, PY3
from six.moves import configparser from six.moves import configparser
try: try:
@ -235,7 +234,7 @@ class VMWareInventory(object):
'groupby_custom_field': False} 'groupby_custom_field': False}
} }
if six.PY3: if PY3:
config = configparser.ConfigParser() config = configparser.ConfigParser()
else: else:
config = configparser.SafeConfigParser() config = configparser.SafeConfigParser()

@ -128,7 +128,7 @@ result:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError as e: except ImportError as e:
pass pass

@ -77,7 +77,7 @@ licenses:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
HAS_PYVMOMI = True HAS_PYVMOMI = True
except ImportError: except ImportError:
HAS_PYVMOMI = False HAS_PYVMOMI = False

@ -81,7 +81,7 @@ dest_file:
import os import os
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -78,11 +78,6 @@ result:
sample: "Datastore cluster 'DSC2' created successfully." sample: "Datastore cluster 'DSC2' created successfully."
""" """
try:
from pyVmomi import vim, vmodl
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native

@ -107,7 +107,7 @@ drs_rule_facts:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -523,9 +523,7 @@ import time
HAS_PYVMOMI = False HAS_PYVMOMI = False
try: try:
import pyVmomi
from pyVmomi import vim, vmodl from pyVmomi import vim, vmodl
HAS_PYVMOMI = True HAS_PYVMOMI = True
except ImportError: except ImportError:
pass pass

@ -87,12 +87,6 @@ instance:
sample: None sample: None
""" """
try:
import pyVmomi
from pyVmomi import vim
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_text from ansible.module_utils._text import to_text
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec

@ -152,15 +152,9 @@ instance:
} }
""" """
try:
import pyVmomi
from pyVmomi import vim
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, connect_to_api, wait_for_task from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task
class PyVmomiHelper(PyVmomi): class PyVmomiHelper(PyVmomi):

@ -221,7 +221,6 @@ instance:
import time import time
try: try:
import pyVmomi
from pyVmomi import vim from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -110,13 +110,6 @@ from ansible.module_utils._text import to_native
from ansible.module_utils.vmware import PyVmomi, gather_vm_facts, vmware_argument_spec from ansible.module_utils.vmware import PyVmomi, gather_vm_facts, vmware_argument_spec
try:
import pyVmomi
from pyVmomi import vim
except ImportError:
pass
class PyVmomiHelper(PyVmomi): class PyVmomiHelper(PyVmomi):
def __init__(self, module): def __init__(self, module):
super(PyVmomiHelper, self).__init__(module) super(PyVmomiHelper, self).__init__(module)

@ -103,7 +103,7 @@ facts:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

@ -107,7 +107,7 @@ from ansible.module_utils.basic import AnsibleModule, bytes_to_human
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -110,7 +110,7 @@ rule_set_state:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -122,7 +122,7 @@ results:
''' '''
try: try:
from pyvmomi import vim, vmodl from pyvmomi import vim
except ImportError: except ImportError:
pass pass

@ -94,7 +94,7 @@ RETURN = r'''#
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -111,11 +111,6 @@ result:
} }
''' '''
try:
from pyVmomi import vim, vmodl
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, TaskError from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, TaskError
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native

@ -66,11 +66,6 @@ local_user_facts:
] ]
''' '''
try:
from pyVmomi import vim, vmodl
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec

@ -78,7 +78,7 @@ resource_pool_facts:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

@ -109,11 +109,6 @@ scsi_tgt_facts:
} }
""" """
try:
from pyVmomi import vim, vmodl
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec

@ -87,7 +87,7 @@ virtual_machines:
''' '''
try: try:
from pyVmomi import vim, vmodl from pyVmomi import vim
except ImportError: except ImportError:
pass pass

Loading…
Cancel
Save