mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* 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:
parent
c0d11f631f
commit
5d6047a21a
22 changed files with 25 additions and 45 deletions
3
changelogs/fragments/5240-unused-imports.yaml
Normal file
3
changelogs/fragments/5240-unused-imports.yaml
Normal 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).
|
|
@ -15,6 +15,7 @@ __metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import traceback
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -28,8 +29,11 @@ try:
|
||||||
import footmark.dns
|
import footmark.dns
|
||||||
import footmark.ram
|
import footmark.ram
|
||||||
import footmark.market
|
import footmark.market
|
||||||
|
|
||||||
|
FOOTMARK_IMP_ERR = None
|
||||||
HAS_FOOTMARK = True
|
HAS_FOOTMARK = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
FOOTMARK_IMP_ERR = traceback.format_exc()
|
||||||
HAS_FOOTMARK = False
|
HAS_FOOTMARK = False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -617,18 +617,10 @@ ids:
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
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
|
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import (
|
||||||
|
ecs_argument_spec, ecs_connect, FOOTMARK_IMP_ERR, HAS_FOOTMARK
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def get_instances_info(connection, ids):
|
def get_instances_info(connection, ids):
|
||||||
|
|
|
@ -341,18 +341,10 @@ ids:
|
||||||
sample: [i-12345er, i-3245fs]
|
sample: [i-12345er, i-3245fs]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import traceback
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
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
|
from ansible_collections.community.general.plugins.module_utils.alicloud_ecs import (
|
||||||
|
ecs_argument_spec, ecs_connect, FOOTMARK_IMP_ERR, HAS_FOOTMARK
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -390,11 +390,10 @@ EXAMPLES = r'''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
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.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
|
|
|
@ -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 (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
proxmox_auth_argument_spec, ProxmoxAnsible)
|
proxmox_auth_argument_spec, ProxmoxAnsible)
|
||||||
|
|
||||||
|
|
|
@ -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 (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
proxmox_auth_argument_spec, ProxmoxAnsible)
|
proxmox_auth_argument_spec, ProxmoxAnsible)
|
||||||
|
|
||||||
|
|
|
@ -803,14 +803,12 @@ msg:
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import quote
|
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.version import LooseVersion
|
||||||
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)
|
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.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ msg:
|
||||||
sample: "Nic net0 unchanged on VM with vmid 103"
|
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)
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,9 @@ RETURN = r'''#'''
|
||||||
import time
|
import time
|
||||||
import traceback
|
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.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):
|
class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
|
|
|
@ -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 (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)
|
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ msg:
|
||||||
sample: 'Task: UPID:xyz:xyz does not exist on node: proxmoxnode'
|
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 (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
proxmox_auth_argument_spec, ProxmoxAnsible)
|
proxmox_auth_argument_spec, ProxmoxAnsible)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ EXAMPLES = '''
|
||||||
import os
|
import os
|
||||||
import time
|
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)
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (proxmox_auth_argument_spec, ProxmoxAnsible)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 (
|
from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)
|
proxmox_auth_argument_spec, ProxmoxAnsible, proxmox_to_ansible_bool)
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
redis_found = True
|
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.formatters import human_to_bytes
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
from ansible_collections.community.general.plugins.module_utils.redis import (
|
from ansible_collections.community.general.plugins.module_utils.redis import (
|
||||||
|
|
|
@ -95,7 +95,6 @@ EXAMPLES = '''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
|
|
@ -151,7 +151,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
# Import Datadog
|
# Import Datadog
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
DATADOG_IMP_ERR = None
|
DATADOG_IMP_ERR = None
|
||||||
HAS_DATADOG = True
|
HAS_DATADOG = True
|
||||||
|
|
|
@ -264,7 +264,6 @@ output:
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
LXML_ETREE_IMP_ERR = None
|
LXML_ETREE_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -106,7 +106,6 @@ CATEGORY_COMMANDS_DEFAULT = {
|
||||||
}
|
}
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible_collections.community.general.plugins.module_utils.ilo_redfish_utils import iLORedfishUtils
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,6 @@ out:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.json_utils import json
|
|
||||||
import traceback
|
import traceback
|
||||||
try:
|
try:
|
||||||
from pyrfc import Connection
|
from pyrfc import Connection
|
||||||
|
|
|
@ -131,7 +131,6 @@ executions:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.six.moves.urllib.parse import quote
|
||||||
from ansible_collections.community.general.plugins.module_utils.rundeck import (
|
from ansible_collections.community.general.plugins.module_utils.rundeck import (
|
||||||
api_argument_spec,
|
api_argument_spec,
|
||||||
|
|
|
@ -174,12 +174,10 @@ execution_info:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Modules import
|
# Modules import
|
||||||
import json
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.six.moves.urllib.parse import quote
|
||||||
from ansible_collections.community.general.plugins.module_utils.rundeck import (
|
from ansible_collections.community.general.plugins.module_utils.rundeck import (
|
||||||
api_argument_spec,
|
api_argument_spec,
|
||||||
|
|
Loading…
Reference in a new issue