1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove unneccessary imports (#5940)

* Remove unneccessary imports.

* Keep unnecessary imports in module_utils - for now.

* Make older sanity tests shut up.

* Also make flake8 happier.
This commit is contained in:
Felix Fontein 2023-02-12 19:48:39 +01:00 committed by GitHub
parent de193ac1bf
commit 2b8ac3c629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 74 additions and 108 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "various plugins and modules - remove unnecessary imports (https://github.com/ansible-collections/community.general/pull/5940)."

View file

@ -52,11 +52,9 @@ import time
from multiprocessing import Lock
from itertools import chain
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils.common._collections_compat import MutableSet
from ansible.plugins.cache import BaseCacheModule
from ansible.release import __version__ as ansible_base_version
from ansible.utils.display import Display
try:

View file

@ -67,12 +67,10 @@ import re
import time
import json
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils.common.text.converters import to_native
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.plugins.cache import BaseCacheModule
from ansible.release import __version__ as ansible_base_version
from ansible.utils.display import Display
try:

View file

@ -27,7 +27,6 @@ DOCUMENTATION = '''
from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.playbook.task_include import TaskInclude

View file

@ -786,10 +786,6 @@ playbook.yml: >
import sys
from contextlib import contextmanager
from ansible import constants as C
from ansible.playbook.task_include import TaskInclude
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.vars.manager import VariableManager
from ansible.plugins.callback.default import CallbackModule as Default

View file

@ -54,7 +54,6 @@ examples: |
import hashlib
import hmac
import base64
import logging
import json
import uuid
import socket

View file

@ -79,7 +79,6 @@ import re
import email.utils
import smtplib
from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_bytes
from ansible.parsing.ajson import AnsibleJSONEncoder
from ansible.plugins.callback import CallbackBase

View file

@ -67,9 +67,6 @@ DOCUMENTATION = '''
type: string
'''
import os
import json
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils.urls import open_url

View file

@ -54,9 +54,6 @@ DOCUMENTATION = '''
version_added: 4.5.0
'''
import os
import json
import logging
import logging.handlers

View file

@ -25,12 +25,10 @@ import yaml
import json
import re
import string
import sys
from ansible.module_utils.common.text.converters import to_bytes, to_text
from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_text
from ansible.parsing.yaml.dumper import AnsibleDumper
from ansible.plugins.callback import CallbackBase, strip_internal_keys, module_response_deepcopy
from ansible.plugins.callback import strip_internal_keys, module_response_deepcopy
from ansible.plugins.callback.default import CallbackModule as Default

View file

@ -80,13 +80,13 @@ from ansible.errors import AnsibleError, AnsibleFilterError
import importlib
try:
import jc
import jc # noqa: F401, pylint: disable=unused-import
HAS_LIB = True
except ImportError:
HAS_LIB = False
def jc(data, parser, quiet=True, raw=False):
def jc_filter(data, parser, quiet=True, raw=False):
"""Convert returned command output to JSON using the JC library
Arguments:
@ -150,5 +150,5 @@ class FilterModule(object):
def filters(self):
return {
'jc': jc
'jc': jc_filter,
}

View file

@ -102,8 +102,6 @@ from ansible.errors import AnsibleFilterError
from ansible.module_utils.six import string_types
from ansible.module_utils.common._collections_compat import Mapping, Sequence
from ansible.utils.vars import merge_hash
from ansible.release import __version__ as ansible_version
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from collections import defaultdict
from operator import itemgetter

View file

@ -121,10 +121,7 @@ compose:
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
'''
import os
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils.six import string_types
from ansible.errors import AnsibleError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable

View file

@ -150,12 +150,10 @@ groupby:
attribute: internals
'''
import binascii
import json
import re
import time
import os
import socket
from ansible.plugins.inventory import BaseInventoryPlugin
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.dict_transformations import dict_merge

View file

@ -65,7 +65,7 @@ from sys import version as python_version
from ansible.errors import AnsibleError
from ansible.module_utils.urls import open_url
from ansible.plugins.inventory import BaseInventoryPlugin
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.ansible_release import __version__ as ansible_version
from ansible.module_utils.six.moves.urllib.parse import urljoin

View file

@ -105,7 +105,6 @@ RETURN = """
type: dict
"""
import os
from ansible.module_utils.six.moves.urllib.parse import urlparse
from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.plugins.lookup import LookupBase

View file

@ -93,8 +93,6 @@ RETURN = """
type: str
"""
import os
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase

View file

@ -80,7 +80,6 @@ from subprocess import Popen
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.parsing.splitter import parse_kv
from ansible.module_utils.common.text.converters import to_bytes, to_text, to_native
from ansible.utils.display import Display

View file

@ -136,12 +136,11 @@ RETURN = '''
import re
from ansible.plugins.lookup import LookupBase
from ansible.utils.display import Display
from ansible.errors import AnsibleLookupError
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.common.text.converters import to_native
from ansible.plugins.lookup import LookupBase
from ansible.errors import AnsibleError, AnsibleLookupError
from ansible.utils.display import Display
try:
import etcd3

View file

@ -61,8 +61,6 @@ RETURN = """
elements: str
"""
import os
from ansible.plugins.lookup import LookupBase
from ansible.utils.cmd_functions import run_cmd
from ansible.module_utils.common.text.converters import to_text

View file

@ -69,7 +69,6 @@ from ansible.utils.display import Display
from traceback import format_exception
import json
import sys
import os
display = Display()

View file

@ -73,8 +73,6 @@ _raw:
elements: str
"""
import os
HAVE_REDIS = False
try:
import redis

View file

@ -19,15 +19,16 @@ import os
import re
import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
# (TODO: remove AnsibleModule from next line!)
from ansible.module_utils.basic import AnsibleModule, missing_required_lib # noqa: F401, pylint: disable=unused-import
from ansible.module_utils.six.moves import configparser
from os.path import expanduser
from uuid import UUID
LIBCLOUD_IMP_ERR = None
try:
from libcloud.common.dimensiondata import API_ENDPOINTS, DimensionDataAPIException, DimensionDataStatus
from libcloud.compute.base import Node, NodeLocation
from libcloud.common.dimensiondata import API_ENDPOINTS, DimensionDataAPIException, DimensionDataStatus # noqa: F401, pylint: disable=unused-import
from libcloud.compute.base import Node, NodeLocation # noqa: F401, pylint: disable=unused-import
from libcloud.compute.providers import get_driver
from libcloud.compute.types import Provider

View file

@ -15,7 +15,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L
REQUESTS_IMP_ERR = None
try:
import requests.exceptions
import requests.exceptions # noqa: F401, pylint: disable=unused-import
HAS_REQUESTS = True
except ImportError:
REQUESTS_IMP_ERR = traceback.format_exc()
@ -25,7 +25,7 @@ INFLUXDB_IMP_ERR = None
try:
from influxdb import InfluxDBClient
from influxdb import __version__ as influxdb_version
from influxdb import exceptions
from influxdb import exceptions # noqa: F401, pylint: disable=unused-import
HAS_INFLUXDB = True
except ImportError:
INFLUXDB_IMP_ERR = traceback.format_exc()

View file

@ -9,7 +9,8 @@ __metaclass__ = type
from ansible.module_utils.common.dict_transformations import dict_merge
from ansible_collections.community.general.plugins.module_utils.mh.base import ModuleHelperBase, AnsibleModule
# (TODO: remove AnsibleModule!) pylint: disable-next-line=unused-import
from ansible_collections.community.general.plugins.module_utils.mh.base import ModuleHelperBase, AnsibleModule # noqa: F401
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin

View file

@ -8,12 +8,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.community.general.plugins.module_utils.mh.module_helper import (
from ansible_collections.community.general.plugins.module_utils.mh.module_helper import ( # noqa: F401, pylint: disable=unused-import
ModuleHelper, StateModuleHelper, CmdModuleHelper, CmdStateModuleHelper, AnsibleModule
)
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin, ArgFormat
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyCtxMgr
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException
from ansible_collections.community.general.plugins.module_utils.mh.deco import cause_changes, module_fails_on_exception
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarMeta, VarDict
from ansible_collections.community.general.plugins.module_utils.mh.mixins.cmd import CmdMixin, ArgFormat # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyCtxMgr # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException # noqa: F401, pylint: disable=unused-import
# pylint: disable-next-line=unused-import
from ansible_collections.community.general.plugins.module_utils.mh.deco import cause_changes, module_fails_on_exception # noqa: F401
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarMeta, VarDict # noqa: F401, pylint: disable=unused-import

View file

@ -16,7 +16,8 @@ __metaclass__ = type
import abc
import collections
import json
import os
# (TODO: remove next line!)
import os # noqa: F401, pylint: disable=unused-import
import traceback
HPE_ONEVIEW_IMP_ERR = None

View file

@ -10,13 +10,14 @@ import logging
import logging.config
import os
import tempfile
from datetime import datetime
# (TODO: remove next line!)
from datetime import datetime # noqa: F401, pylint: disable=unused-import
from operator import eq
import time
try:
import yaml
import yaml # noqa: F401, pylint: disable=unused-import
import oci
from oci.constants import HEADER_NEXT_PAGE

View file

@ -7,9 +7,12 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import atexit
import time
import re
# (TODO: remove next line!)
import atexit # noqa: F401, pylint: disable=unused-import
# (TODO: remove next line!)
import time # noqa: F401, pylint: disable=unused-import
# (TODO: remove next line!)
import re # noqa: F401, pylint: disable=unused-import
import traceback
PROXMOXER_IMP_ERR = None
@ -22,7 +25,8 @@ except ImportError:
from ansible.module_utils.basic import env_fallback, missing_required_lib
from ansible.module_utils.common.text.converters import to_native
# (TODO: remove next line!)
from ansible.module_utils.common.text.converters import to_native # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion

View file

@ -21,13 +21,15 @@ except ImportError:
HAS_PURITY_FB = True
try:
from purity_fb import PurityFb, FileSystem, FileSystemSnapshot, SnapshotSuffix, rest
from purity_fb import PurityFb, FileSystem, FileSystemSnapshot, SnapshotSuffix, rest # noqa: F401, pylint: disable=unused-import
except ImportError:
HAS_PURITY_FB = False
from functools import wraps
# (TODO: remove next line!)
from functools import wraps # noqa: F401, pylint: disable=unused-import
from os import environ
from os import path
# (TODO: remove next line!)
from os import path # noqa: F401, pylint: disable=unused-import
import platform
VERSION = 1.2

View file

@ -13,10 +13,10 @@ __metaclass__ = type
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import LooseVersion
from ansible.module_utils.compat.version import LooseVersion # noqa: F401, pylint: disable=unused-import
except ImportError:
try:
from distutils.version import LooseVersion
from distutils.version import LooseVersion # noqa: F401, pylint: disable=unused-import
except ImportError as exc:
msg = 'To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present'
raise_from(ImportError(msg), exc)

View file

@ -182,7 +182,7 @@ from ansible.module_utils.six import integer_types
GITLAB_IMP_ERR = None
try:
import gitlab
import gitlab # noqa: F401, pylint: disable=unused-import
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()

View file

@ -295,7 +295,6 @@ import io
import json
import os
import tempfile
import time
from ansible.module_utils.basic import AnsibleModule, to_bytes
from ansible.module_utils.six.moves import http_cookiejar as cookiejar

View file

@ -206,7 +206,7 @@ end_state:
'''
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak \
import KeycloakAPI, camel, keycloak_argument_spec, get_token, KeycloakError, is_struct_included
import KeycloakAPI, keycloak_argument_spec, get_token, KeycloakError, is_struct_included
from ansible.module_utils.basic import AnsibleModule

View file

@ -201,8 +201,9 @@ end_state:
}
'''
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
keycloak_argument_spec, get_token, KeycloakError, is_struct_included
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import (
KeycloakAPI, keycloak_argument_spec, get_token, KeycloakError,
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -295,7 +295,7 @@ end_state:
'''
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
keycloak_argument_spec, get_token, KeycloakError, is_struct_included
keycloak_argument_spec, get_token, KeycloakError
from ansible.module_utils.basic import AnsibleModule

View file

@ -225,8 +225,8 @@ end_state:
}
'''
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
keycloak_argument_spec, get_token, KeycloakError, is_struct_included
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, \
keycloak_argument_spec, get_token, KeycloakError
from ansible.module_utils.basic import AnsibleModule

View file

@ -433,7 +433,7 @@ else:
HAS_LXC = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.parsing.convert_bool import boolean, BOOLEANS_FALSE
from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE
from ansible.module_utils.common.text.converters import to_text, to_bytes

View file

@ -99,7 +99,6 @@ EXAMPLES = '''
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves import shlex_quote
def selfupdate(module, port_path):

View file

@ -81,7 +81,7 @@ profiles:
'''
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.manageiq import ManageIQ, ManageIQPolicies, manageiq_argument_spec, manageiq_entities
from ansible_collections.community.general.plugins.module_utils.manageiq import ManageIQ, manageiq_argument_spec, manageiq_entities
def main():

View file

@ -97,7 +97,6 @@ EXAMPLES = '''
RETURN = r''' # '''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
import os
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion

View file

@ -166,7 +166,6 @@ memset_api:
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.memset import get_zone_id
from ansible_collections.community.general.plugins.module_utils.memset import memset_api_call
from ansible_collections.community.general.plugins.module_utils.memset import get_zone_id
def api_validation(args=None):

View file

@ -101,10 +101,6 @@ import os
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
from ansible_collections.community.general.plugins.module_utils.module_helper import (
ArgFormat
)
class MkSysB(ModuleHelper):
module = dict(

View file

@ -165,7 +165,7 @@ operationStatusId:
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.six.moves.urllib.parse import quote_plus, urljoin
from ansible.module_utils.six.moves.urllib.parse import urljoin
# More will be added as module features are expanded
CATEGORY_COMMANDS_ALL = {

View file

@ -141,7 +141,7 @@ status:
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.six.moves.urllib.parse import quote_plus, urljoin
from ansible.module_utils.six.moves.urllib.parse import urljoin
# More will be added as module features are expanded
CATEGORY_COMMANDS_ALL = {

View file

@ -292,8 +292,6 @@ try:
except ImportError:
HAS_PACKET_SDK = False
from ansible.module_utils.basic import AnsibleModule
NAME_RE = r'({0}|{0}{1}*{0})'.format(r'[a-zA-Z0-9]', r'[a-zA-Z0-9\-]')
HOSTNAME_RE = r'({0}\.)*{0}$'.format(NAME_RE)

View file

@ -177,7 +177,6 @@ import datetime
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves.urllib.parse import quote as urlquote
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway
SCALEWAY_SERVER_STATES = (

View file

@ -200,7 +200,7 @@ container:
from copy import deepcopy
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
SecretVariables
)

View file

@ -89,7 +89,7 @@ container:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -126,7 +126,7 @@ container_namespace:
from copy import deepcopy
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
scaleway_waitable_resource_argument_spec,
resource_attributes_should_be_changed, SecretVariables
)

View file

@ -81,7 +81,7 @@ container_namespace:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -113,7 +113,7 @@ container_registry:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -80,7 +80,7 @@ container_registry:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -184,7 +184,7 @@ function:
from copy import deepcopy
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
SecretVariables
)

View file

@ -89,7 +89,7 @@ function:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -126,7 +126,7 @@ function_namespace:
from copy import deepcopy
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
SecretVariables
)

View file

@ -81,7 +81,7 @@ function_namespace:
'''
from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_ENDPOINT, SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway
SCALEWAY_REGIONS, scaleway_argument_spec, Scaleway,
)
from ansible.module_utils.basic import AnsibleModule

View file

@ -133,11 +133,10 @@ data:
import traceback
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway, payload_from_object
from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
try:
from ipaddress import ip_network
from ipaddress import ip_network # noqa: F401, pylint: disable=unused-import
except ImportError:
IPADDRESS_IMP_ERR = traceback.format_exc()
HAS_IPADDRESS = False

View file

@ -153,13 +153,13 @@ instance:
HAS_XENAPI = False
try:
import XenAPI
import XenAPI # noqa: F401, pylint: disable=unused-import
HAS_XENAPI = True
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.xenserver import (xenserver_common_argument_spec, XAPI, XenServerObject, get_object_ref,
from ansible_collections.community.general.plugins.module_utils.xenserver import (xenserver_common_argument_spec, XenServerObject, get_object_ref,
gather_vm_params, gather_vm_facts)

View file

@ -173,13 +173,13 @@ instance:
HAS_XENAPI = False
try:
import XenAPI
import XenAPI # noqa: F401, pylint: disable=unused-import
HAS_XENAPI = True
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.xenserver import (xenserver_common_argument_spec, XAPI, XenServerObject, get_object_ref,
from ansible_collections.community.general.plugins.module_utils.xenserver import (xenserver_common_argument_spec, XenServerObject, get_object_ref,
gather_vm_params, gather_vm_facts, set_vm_power_state,
wait_for_vm_ip_address)