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

multiple modules: removed unused imports (#5240) (#5257)

* multiple modules: removed unused imports

* fixed ali_instance(_info) import check

* add changelog fragment

* Update changelogs/fragments/5240-unused-imports.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 775be1d3f3)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-09-09 22:38:29 +02:00 committed by GitHub
parent c0d11f631f
commit 5d6047a21a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 25 additions and 45 deletions

View file

@ -0,0 +1,3 @@
minor_changes:
- ali_instance - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5240).
- ali_instance_info - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5240).

View file

@ -15,6 +15,7 @@ __metaclass__ = type
import os
import json
import traceback
from ansible.module_utils.basic import env_fallback
try:
@ -28,8 +29,11 @@ try:
import footmark.dns
import footmark.ram
import footmark.market
FOOTMARK_IMP_ERR = None
HAS_FOOTMARK = True
except ImportError:
FOOTMARK_IMP_ERR = traceback.format_exc()
HAS_FOOTMARK = False

View file

@ -617,18 +617,10 @@ ids:
import re
import time
import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import ecs_argument_spec, ecs_connect
HAS_FOOTMARK = False
FOOTMARK_IMP_ERR = None
try:
from footmark.exception import ECSResponseError
HAS_FOOTMARK = True
except ImportError:
FOOTMARK_IMP_ERR = traceback.format_exc()
HAS_FOOTMARK = False
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import (
ecs_argument_spec, ecs_connect, FOOTMARK_IMP_ERR, HAS_FOOTMARK
)
def get_instances_info(connection, ids):

View file

@ -341,18 +341,10 @@ ids:
sample: [i-12345er, i-3245fs]
'''
import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import ecs_argument_spec, ecs_connect
HAS_FOOTMARK = False
FOOTMARK_IMP_ERR = None
try:
from footmark.exception import ECSResponseError
HAS_FOOTMARK = True
except ImportError:
FOOTMARK_IMP_ERR = traceback.format_exc()
HAS_FOOTMARK = False
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import (
ecs_argument_spec, ecs_connect, FOOTMARK_IMP_ERR, HAS_FOOTMARK
)
def main():

View file

@ -390,11 +390,10 @@ EXAMPLES = r'''
'''
import time
import traceback
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.proxmox import (

View file

@ -75,7 +75,7 @@ proxmox_domains:
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (
proxmox_auth_argument_spec, ProxmoxAnsible)

View file

@ -72,7 +72,7 @@ proxmox_groups:
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (
proxmox_auth_argument_spec, ProxmoxAnsible)

View file

@ -803,14 +803,12 @@ msg:
import re
import time
import traceback
from ansible.module_utils.six.moves.urllib.parse import quote
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.parsing.convert_bool import boolean

View file

@ -137,7 +137,7 @@ msg:
sample: "Nic net0 unchanged on VM with vmid 103"
'''
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)

View file

@ -102,9 +102,9 @@ RETURN = r'''#'''
import time
import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible, HAS_PROXMOXER, PROXMOXER_IMP_ERR)
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)
class ProxmoxSnapAnsible(ProxmoxAnsible):

View file

@ -110,7 +110,7 @@ proxmox_storages:
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)

View file

@ -115,7 +115,7 @@ msg:
sample: 'Task: UPID:xyz:xyz does not exist on node: proxmoxnode'
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (
proxmox_auth_argument_spec, ProxmoxAnsible)

View file

@ -117,7 +117,7 @@ EXAMPLES = '''
import os
import time
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)

View file

@ -155,7 +155,7 @@ proxmox_users:
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.proxmox import (
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)

View file

@ -139,7 +139,7 @@ except ImportError:
else:
redis_found = True
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.formatters import human_to_bytes
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.redis import (

View file

@ -95,7 +95,6 @@ EXAMPLES = '''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
from ansible.module_utils.six.moves.urllib.parse import urlencode
# ===========================================

View file

@ -151,7 +151,6 @@ import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
# Import Datadog
from ansible.module_utils.common.text.converters import to_native
DATADOG_IMP_ERR = None
HAS_DATADOG = True

View file

@ -264,7 +264,6 @@ output:
import datetime
import os
import traceback
from functools import partial
LXML_ETREE_IMP_ERR = None
try:

View file

@ -106,7 +106,6 @@ CATEGORY_COMMANDS_DEFAULT = {
}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.ilo_redfish_utils import iLORedfishUtils

View file

@ -179,7 +179,6 @@ out:
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.json_utils import json
import traceback
try:
from pyrfc import Connection

View file

@ -131,7 +131,6 @@ executions:
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.six.moves.urllib.parse import quote
from ansible_collections.community.general.plugins.module_utils.rundeck import (
api_argument_spec,

View file

@ -174,12 +174,10 @@ execution_info:
'''
# Modules import
import json
from datetime import datetime, timedelta
from time import sleep
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.six.moves.urllib.parse import quote
from ansible_collections.community.general.plugins.module_utils.rundeck import (
api_argument_spec,