mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #5940/2b8ac3c6 backport][stable-6] Remove unneccessary imports (#5976)
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.
(cherry picked from commit 2b8ac3c629
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
ab4f96105c
commit
554ec94110
60 changed files with 74 additions and 108 deletions
2
changelogs/fragments/remove-unneeded-imports.yml
Normal file
2
changelogs/fragments/remove-unneeded-imports.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "various plugins and modules - remove unnecessary imports (https://github.com/ansible-collections/community.general/pull/5940)."
|
2
plugins/cache/memcached.py
vendored
2
plugins/cache/memcached.py
vendored
|
@ -52,11 +52,9 @@ import time
|
||||||
from multiprocessing import Lock
|
from multiprocessing import Lock
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
from ansible import constants as C
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.common._collections_compat import MutableSet
|
from ansible.module_utils.common._collections_compat import MutableSet
|
||||||
from ansible.plugins.cache import BaseCacheModule
|
from ansible.plugins.cache import BaseCacheModule
|
||||||
from ansible.release import __version__ as ansible_base_version
|
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
2
plugins/cache/redis.py
vendored
2
plugins/cache/redis.py
vendored
|
@ -67,12 +67,10 @@ import re
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible import constants as C
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
|
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
|
||||||
from ansible.plugins.cache import BaseCacheModule
|
from ansible.plugins.cache import BaseCacheModule
|
||||||
from ansible.release import __version__ as ansible_base_version
|
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -27,7 +27,6 @@ DOCUMENTATION = '''
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
from ansible.utils.color import colorize, hostcolor
|
from ansible.utils.color import colorize, hostcolor
|
||||||
from ansible.template import Templar
|
|
||||||
from ansible.playbook.task_include import TaskInclude
|
from ansible.playbook.task_include import TaskInclude
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -786,10 +786,6 @@ playbook.yml: >
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from contextlib import contextmanager
|
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.template import Templar
|
||||||
from ansible.vars.manager import VariableManager
|
from ansible.vars.manager import VariableManager
|
||||||
from ansible.plugins.callback.default import CallbackModule as Default
|
from ansible.plugins.callback.default import CallbackModule as Default
|
||||||
|
|
|
@ -54,7 +54,6 @@ examples: |
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
import base64
|
||||||
import logging
|
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
import socket
|
import socket
|
||||||
|
|
|
@ -79,7 +79,6 @@ import re
|
||||||
import email.utils
|
import email.utils
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
from ansible.module_utils.six import string_types
|
|
||||||
from ansible.module_utils.common.text.converters import to_bytes
|
from ansible.module_utils.common.text.converters import to_bytes
|
||||||
from ansible.parsing.ajson import AnsibleJSONEncoder
|
from ansible.parsing.ajson import AnsibleJSONEncoder
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
|
|
|
@ -67,9 +67,6 @@ DOCUMENTATION = '''
|
||||||
type: string
|
type: string
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
from ansible.module_utils.common.text.converters import to_bytes
|
from ansible.module_utils.common.text.converters import to_bytes
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
|
|
|
@ -54,9 +54,6 @@ DOCUMENTATION = '''
|
||||||
version_added: 4.5.0
|
version_added: 4.5.0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,10 @@ import yaml
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import sys
|
|
||||||
|
|
||||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
from ansible.module_utils.six import string_types
|
|
||||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
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
|
from ansible.plugins.callback.default import CallbackModule as Default
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,13 +80,13 @@ from ansible.errors import AnsibleError, AnsibleFilterError
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import jc
|
import jc # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_LIB = True
|
HAS_LIB = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIB = False
|
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
|
"""Convert returned command output to JSON using the JC library
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
@ -150,5 +150,5 @@ class FilterModule(object):
|
||||||
|
|
||||||
def filters(self):
|
def filters(self):
|
||||||
return {
|
return {
|
||||||
'jc': jc
|
'jc': jc_filter,
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,6 @@ from ansible.errors import AnsibleFilterError
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
from ansible.module_utils.common._collections_compat import Mapping, Sequence
|
from ansible.module_utils.common._collections_compat import Mapping, Sequence
|
||||||
from ansible.utils.vars import merge_hash
|
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 collections import defaultdict
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
|
@ -121,10 +121,7 @@ compose:
|
||||||
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
|
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
from ansible.errors import AnsibleError
|
||||||
|
|
||||||
from ansible.errors import AnsibleError, AnsibleParserError
|
|
||||||
from ansible.module_utils.six import string_types
|
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,12 +150,10 @@ groupby:
|
||||||
attribute: internals
|
attribute: internals
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import binascii
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin
|
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_native, to_text
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
|
|
|
@ -65,7 +65,7 @@ from sys import version as python_version
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin
|
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.ansible_release import __version__ as ansible_version
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urljoin
|
from ansible.module_utils.six.moves.urllib.parse import urljoin
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ RETURN = """
|
||||||
type: dict
|
type: dict
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||||
from ansible.errors import AnsibleError, AnsibleAssertionError
|
from ansible.errors import AnsibleError, AnsibleAssertionError
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
|
|
@ -93,8 +93,6 @@ RETURN = """
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ from subprocess import Popen
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.plugins.lookup import LookupBase
|
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.module_utils.common.text.converters import to_bytes, to_text, to_native
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
|
|
|
@ -136,12 +136,11 @@ RETURN = '''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.errors import AnsibleLookupError
|
||||||
from ansible.utils.display import Display
|
|
||||||
from ansible.module_utils.basic import missing_required_lib
|
from ansible.module_utils.basic import missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
from ansible.errors import AnsibleError, AnsibleLookupError
|
from ansible.utils.display import Display
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import etcd3
|
import etcd3
|
||||||
|
|
|
@ -61,8 +61,6 @@ RETURN = """
|
||||||
elements: str
|
elements: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
from ansible.utils.cmd_functions import run_cmd
|
from ansible.utils.cmd_functions import run_cmd
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
|
|
|
@ -69,7 +69,6 @@ from ansible.utils.display import Display
|
||||||
from traceback import format_exception
|
from traceback import format_exception
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
|
|
||||||
display = Display()
|
display = Display()
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,6 @@ _raw:
|
||||||
elements: str
|
elements: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
HAVE_REDIS = False
|
HAVE_REDIS = False
|
||||||
try:
|
try:
|
||||||
import redis
|
import redis
|
||||||
|
|
|
@ -19,15 +19,16 @@ import os
|
||||||
import re
|
import re
|
||||||
import traceback
|
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 ansible.module_utils.six.moves import configparser
|
||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
LIBCLOUD_IMP_ERR = None
|
LIBCLOUD_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
from libcloud.common.dimensiondata import API_ENDPOINTS, DimensionDataAPIException, DimensionDataStatus
|
from libcloud.common.dimensiondata import API_ENDPOINTS, DimensionDataAPIException, DimensionDataStatus # noqa: F401, pylint: disable=unused-import
|
||||||
from libcloud.compute.base import Node, NodeLocation
|
from libcloud.compute.base import Node, NodeLocation # noqa: F401, pylint: disable=unused-import
|
||||||
from libcloud.compute.providers import get_driver
|
from libcloud.compute.providers import get_driver
|
||||||
from libcloud.compute.types import Provider
|
from libcloud.compute.types import Provider
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L
|
||||||
|
|
||||||
REQUESTS_IMP_ERR = None
|
REQUESTS_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
import requests.exceptions
|
import requests.exceptions # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_REQUESTS = True
|
HAS_REQUESTS = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
REQUESTS_IMP_ERR = traceback.format_exc()
|
REQUESTS_IMP_ERR = traceback.format_exc()
|
||||||
|
@ -25,7 +25,7 @@ INFLUXDB_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
from influxdb import __version__ as influxdb_version
|
from influxdb import __version__ as influxdb_version
|
||||||
from influxdb import exceptions
|
from influxdb import exceptions # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_INFLUXDB = True
|
HAS_INFLUXDB = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
INFLUXDB_IMP_ERR = traceback.format_exc()
|
INFLUXDB_IMP_ERR = traceback.format_exc()
|
||||||
|
|
|
@ -9,7 +9,8 @@ __metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
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.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.state import StateMixin
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin
|
from ansible_collections.community.general.plugins.module_utils.mh.mixins.deps import DependencyMixin
|
||||||
|
|
|
@ -8,12 +8,13 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__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
|
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.cmd import CmdMixin, ArgFormat # noqa: F401, pylint: disable=unused-import
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.state import StateMixin
|
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
|
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
|
from ansible_collections.community.general.plugins.module_utils.mh.exceptions import ModuleHelperException # noqa: F401, pylint: disable=unused-import
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.deco import cause_changes, module_fails_on_exception
|
# pylint: disable-next-line=unused-import
|
||||||
from ansible_collections.community.general.plugins.module_utils.mh.mixins.vars import VarMeta, VarDict
|
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
|
||||||
|
|
|
@ -16,7 +16,8 @@ __metaclass__ = type
|
||||||
import abc
|
import abc
|
||||||
import collections
|
import collections
|
||||||
import json
|
import json
|
||||||
import os
|
# (TODO: remove next line!)
|
||||||
|
import os # noqa: F401, pylint: disable=unused-import
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
HPE_ONEVIEW_IMP_ERR = None
|
HPE_ONEVIEW_IMP_ERR = None
|
||||||
|
|
|
@ -10,13 +10,14 @@ import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from datetime import datetime
|
# (TODO: remove next line!)
|
||||||
|
from datetime import datetime # noqa: F401, pylint: disable=unused-import
|
||||||
from operator import eq
|
from operator import eq
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yaml
|
import yaml # noqa: F401, pylint: disable=unused-import
|
||||||
|
|
||||||
import oci
|
import oci
|
||||||
from oci.constants import HEADER_NEXT_PAGE
|
from oci.constants import HEADER_NEXT_PAGE
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import atexit
|
# (TODO: remove next line!)
|
||||||
import time
|
import atexit # noqa: F401, pylint: disable=unused-import
|
||||||
import re
|
# (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
|
import traceback
|
||||||
|
|
||||||
PROXMOXER_IMP_ERR = None
|
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.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
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,15 @@ except ImportError:
|
||||||
|
|
||||||
HAS_PURITY_FB = True
|
HAS_PURITY_FB = True
|
||||||
try:
|
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:
|
except ImportError:
|
||||||
HAS_PURITY_FB = False
|
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 environ
|
||||||
from os import path
|
# (TODO: remove next line!)
|
||||||
|
from os import path # noqa: F401, pylint: disable=unused-import
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
VERSION = 1.2
|
VERSION = 1.2
|
||||||
|
|
|
@ -13,10 +13,10 @@ __metaclass__ = type
|
||||||
from ansible.module_utils.six import raise_from
|
from ansible.module_utils.six import raise_from
|
||||||
|
|
||||||
try:
|
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:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion # noqa: F401, pylint: disable=unused-import
|
||||||
except ImportError as exc:
|
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'
|
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)
|
raise_from(ImportError(msg), exc)
|
||||||
|
|
|
@ -182,7 +182,7 @@ from ansible.module_utils.six import integer_types
|
||||||
|
|
||||||
GITLAB_IMP_ERR = None
|
GITLAB_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
import gitlab
|
import gitlab # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_GITLAB_PACKAGE = True
|
HAS_GITLAB_PACKAGE = True
|
||||||
except Exception:
|
except Exception:
|
||||||
GITLAB_IMP_ERR = traceback.format_exc()
|
GITLAB_IMP_ERR = traceback.format_exc()
|
||||||
|
|
|
@ -295,7 +295,6 @@ import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, to_bytes
|
from ansible.module_utils.basic import AnsibleModule, to_bytes
|
||||||
from ansible.module_utils.six.moves import http_cookiejar as cookiejar
|
from ansible.module_utils.six.moves import http_cookiejar as cookiejar
|
||||||
|
|
|
@ -206,7 +206,7 @@ end_state:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak \
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,9 @@ end_state:
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
|
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import (
|
||||||
keycloak_argument_spec, get_token, KeycloakError, is_struct_included
|
KeycloakAPI, keycloak_argument_spec, get_token, KeycloakError,
|
||||||
|
)
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ end_state:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,8 +225,8 @@ end_state:
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, camel, \
|
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import KeycloakAPI, \
|
||||||
keycloak_argument_spec, get_token, KeycloakError, is_struct_included
|
keycloak_argument_spec, get_token, KeycloakError
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,7 @@ else:
|
||||||
HAS_LXC = True
|
HAS_LXC = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible.module_utils.common.text.converters import to_text, to_bytes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,6 @@ EXAMPLES = '''
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six.moves import shlex_quote
|
|
||||||
|
|
||||||
|
|
||||||
def selfupdate(module, port_path):
|
def selfupdate(module, port_path):
|
||||||
|
|
|
@ -81,7 +81,7 @@ profiles:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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():
|
def main():
|
||||||
|
|
|
@ -97,7 +97,6 @@ EXAMPLES = '''
|
||||||
RETURN = r''' # '''
|
RETURN = r''' # '''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
|
|
@ -166,7 +166,6 @@ memset_api:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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 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 memset_api_call
|
||||||
from ansible_collections.community.general.plugins.module_utils.memset import get_zone_id
|
|
||||||
|
|
||||||
|
|
||||||
def api_validation(args=None):
|
def api_validation(args=None):
|
||||||
|
|
|
@ -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.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 ModuleHelper
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
|
||||||
ArgFormat
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MkSysB(ModuleHelper):
|
class MkSysB(ModuleHelper):
|
||||||
module = dict(
|
module = dict(
|
||||||
|
|
|
@ -165,7 +165,7 @@ operationStatusId:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils
|
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.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
|
# More will be added as module features are expanded
|
||||||
CATEGORY_COMMANDS_ALL = {
|
CATEGORY_COMMANDS_ALL = {
|
||||||
|
|
|
@ -141,7 +141,7 @@ status:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils
|
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.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
|
# More will be added as module features are expanded
|
||||||
CATEGORY_COMMANDS_ALL = {
|
CATEGORY_COMMANDS_ALL = {
|
||||||
|
|
|
@ -292,8 +292,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PACKET_SDK = False
|
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\-]')
|
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)
|
HOSTNAME_RE = r'({0}\.)*{0}$'.format(NAME_RE)
|
||||||
|
|
|
@ -177,7 +177,6 @@ import datetime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway
|
||||||
|
|
||||||
SCALEWAY_SERVER_STATES = (
|
SCALEWAY_SERVER_STATES = (
|
||||||
|
|
|
@ -200,7 +200,7 @@ container:
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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,
|
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
|
||||||
SecretVariables
|
SecretVariables
|
||||||
)
|
)
|
||||||
|
|
|
@ -89,7 +89,7 @@ container:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ container_namespace:
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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,
|
scaleway_waitable_resource_argument_spec,
|
||||||
resource_attributes_should_be_changed, SecretVariables
|
resource_attributes_should_be_changed, SecretVariables
|
||||||
)
|
)
|
||||||
|
|
|
@ -81,7 +81,7 @@ container_namespace:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ container_registry:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed
|
||||||
)
|
)
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
|
@ -80,7 +80,7 @@ container_registry:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ function:
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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,
|
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
|
||||||
SecretVariables
|
SecretVariables
|
||||||
)
|
)
|
||||||
|
|
|
@ -89,7 +89,7 @@ function:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ function_namespace:
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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,
|
scaleway_waitable_resource_argument_spec, resource_attributes_should_be_changed,
|
||||||
SecretVariables
|
SecretVariables
|
||||||
)
|
)
|
||||||
|
|
|
@ -81,7 +81,7 @@ function_namespace:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
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
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,10 @@ data:
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway, payload_from_object
|
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
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network # noqa: F401, pylint: disable=unused-import
|
||||||
except ImportError:
|
except ImportError:
|
||||||
IPADDRESS_IMP_ERR = traceback.format_exc()
|
IPADDRESS_IMP_ERR = traceback.format_exc()
|
||||||
HAS_IPADDRESS = False
|
HAS_IPADDRESS = False
|
||||||
|
|
|
@ -153,13 +153,13 @@ instance:
|
||||||
|
|
||||||
HAS_XENAPI = False
|
HAS_XENAPI = False
|
||||||
try:
|
try:
|
||||||
import XenAPI
|
import XenAPI # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_XENAPI = True
|
HAS_XENAPI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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)
|
gather_vm_params, gather_vm_facts)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,13 +173,13 @@ instance:
|
||||||
|
|
||||||
HAS_XENAPI = False
|
HAS_XENAPI = False
|
||||||
try:
|
try:
|
||||||
import XenAPI
|
import XenAPI # noqa: F401, pylint: disable=unused-import
|
||||||
HAS_XENAPI = True
|
HAS_XENAPI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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,
|
gather_vm_params, gather_vm_facts, set_vm_power_state,
|
||||||
wait_for_vm_ip_address)
|
wait_for_vm_ip_address)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue