mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Prepare for distutils.version being removed in Python 2.12.
* Fix copy'n'paste error.
* Re-add Loose prefix.
* Fix Python version typos.
* Improve formulation.
* Move message into own line.
* Fix casing, now that the object is no longer called Version.
(cherry picked from commit a2f72be6c8
)
This commit is contained in:
parent
73580d09e0
commit
e02568d28a
39 changed files with 102 additions and 59 deletions
2
changelogs/fragments/3936-distutils.version.yml
Normal file
2
changelogs/fragments/3936-distutils.version.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "Various modules and plugins - use vendored version of ``distutils.version`` included in ansible-core 2.12 if available. This avoids breakage when ``distutils`` is removed from the standard library of Python 3.12. Note that ansible-core 2.11, ansible-base 2.10 and Ansible 2.9 are right now not compatible with Python 3.12, hence this fix does not target these ansible-core/-base/2.9 versions (https://github.com/ansible-collections/community.general/pull/3936)."
|
|
@ -5,7 +5,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
def version_sort(value, reverse=False):
|
||||
|
|
|
@ -68,7 +68,6 @@ user: ansible-tester
|
|||
password: secure
|
||||
'''
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
import socket
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
|
|
|
@ -119,12 +119,13 @@ compose:
|
|||
import re
|
||||
|
||||
from ansible.module_utils.common._collections_compat import MutableMapping
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
# 3rd party imports
|
||||
try:
|
||||
import requests
|
||||
|
|
|
@ -8,12 +8,13 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
from urllib import quote_plus # Python 2.X
|
||||
except ImportError:
|
||||
|
@ -90,7 +91,7 @@ def gitlabAuthentication(module):
|
|||
# python-gitlab library remove support for username/password authentication since 1.13.0
|
||||
# Changelog : https://github.com/python-gitlab/python-gitlab/releases/tag/v1.13.0
|
||||
# This condition allow to still support older version of the python-gitlab library
|
||||
if StrictVersion(gitlab.__version__) < StrictVersion("1.13.0"):
|
||||
if LooseVersion(gitlab.__version__) < LooseVersion("1.13.0"):
|
||||
gitlab_instance = gitlab.Gitlab(url=gitlab_url, ssl_verify=validate_certs, email=gitlab_user, password=gitlab_password,
|
||||
private_token=gitlab_token, api_version=4)
|
||||
else:
|
||||
|
|
|
@ -9,7 +9,8 @@ __metaclass__ = type
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
20
plugins/module_utils/version.py
Normal file
20
plugins/module_utils/version.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2021, Felix Fontein <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
"""Provide version object to compare version numbers."""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.six import raise_from
|
||||
|
||||
try:
|
||||
from ansible.module_utils.compat.version import LooseVersion
|
||||
except ImportError:
|
||||
try:
|
||||
from distutils.version import LooseVersion
|
||||
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)
|
|
@ -120,7 +120,7 @@ __version__ = '${version}'
|
|||
import os
|
||||
import traceback
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -161,7 +161,8 @@ __version__ = '${version}'
|
|||
import json
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -89,7 +89,8 @@ __version__ = '${version}'
|
|||
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -132,8 +133,7 @@ class ClcBlueprintPackage:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -162,7 +162,8 @@ import os
|
|||
import traceback
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||
from time import sleep
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -203,8 +204,7 @@ class ClcFirewallPolicy:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -207,7 +207,8 @@ __version__ = '${version}'
|
|||
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -210,7 +210,8 @@ import json
|
|||
import os
|
||||
import traceback
|
||||
from time import sleep
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -255,8 +256,7 @@ class ClcLoadBalancer:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -311,7 +311,8 @@ __version__ = '${version}'
|
|||
import json
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -355,8 +356,7 @@ class ClcModifyServer:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -117,7 +117,8 @@ __version__ = '${version}'
|
|||
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -433,7 +433,8 @@ import json
|
|||
import os
|
||||
import time
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -478,8 +479,7 @@ class ClcServer:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -101,7 +101,8 @@ __version__ = '${version}'
|
|||
|
||||
import os
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
@ -145,8 +146,7 @@ class ClcSnapshot:
|
|||
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
|
||||
if not REQUESTS_FOUND:
|
||||
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
|
||||
if requests.__version__ and LooseVersion(
|
||||
requests.__version__) < LooseVersion('2.5.0'):
|
||||
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
|
||||
self.module.fail_json(
|
||||
msg='requests library version should be >= 2.5.0')
|
||||
|
||||
|
|
|
@ -363,7 +363,8 @@ EXAMPLES = r'''
|
|||
|
||||
import time
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
from proxmoxer import ProxmoxAPI
|
||||
|
|
|
@ -761,9 +761,10 @@ msg:
|
|||
import re
|
||||
import time
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.six.moves.urllib.parse import quote
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
from proxmoxer import ProxmoxAPI
|
||||
HAS_PROXMOXER = True
|
||||
|
|
|
@ -230,11 +230,12 @@ command:
|
|||
import os
|
||||
import json
|
||||
import tempfile
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
module = None
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ EXAMPLES = '''
|
|||
register: my_volume
|
||||
'''
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
import pyrax
|
||||
|
|
|
@ -117,9 +117,10 @@ state:
|
|||
'''
|
||||
|
||||
import os
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
PACKAGE_STATE_MAP = dict(
|
||||
present="--install",
|
||||
|
|
|
@ -356,9 +356,10 @@ import os
|
|||
import re
|
||||
import traceback
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from io import BytesIO
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
LXML_IMP_ERR = None
|
||||
try:
|
||||
from lxml import etree, objectify
|
||||
|
|
|
@ -74,11 +74,12 @@ subca:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
class SubCAIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
|
|
|
@ -143,7 +143,8 @@ annotation:
|
|||
import json
|
||||
import time
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -146,9 +146,10 @@ EXAMPLES = '''
|
|||
RETURN = r"""# """
|
||||
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
import re
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
class DNSimpleV1():
|
||||
"""class which uses dnsimple-python < 2"""
|
||||
|
|
|
@ -124,7 +124,8 @@ import os
|
|||
import ssl
|
||||
import traceback
|
||||
import platform
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
HAS_PAHOMQTT = True
|
||||
PAHOMQTT_IMP_ERR = None
|
||||
|
@ -207,7 +208,7 @@ def main():
|
|||
if tls_version:
|
||||
tls_version = tls_map.get(tls_version, ssl.PROTOCOL_SSLv23)
|
||||
else:
|
||||
if LooseVersion(platform.python_version()) <= "3.5.2":
|
||||
if LooseVersion(platform.python_version()) <= LooseVersion("3.5.2"):
|
||||
# Specifying `None` on later versions of python seems sufficient to
|
||||
# instruct python to autonegotiate the SSL/TLS connection. On versions
|
||||
# 3.5.2 and lower though we need to specify the version.
|
||||
|
|
|
@ -124,7 +124,7 @@ EXAMPLES = r'''
|
|||
import os
|
||||
import traceback
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
SENDGRID_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -152,11 +152,11 @@ stdout:
|
|||
sample: "org.gnome.Calendar/x86_64/stable\tcurrent\norg.gnome.gitg/x86_64/stable\tcurrent\n"
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
OUTDATED_FLATPAK_VERSION_ERROR_MESSAGE = "Unknown option --columns=application"
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@ def install_flat(module, binary, remote, names, method, no_dependencies):
|
|||
id_names.append(name)
|
||||
base_command = [binary, "install", "--{0}".format(method)]
|
||||
flatpak_version = _flatpak_version(module, binary)
|
||||
if StrictVersion(flatpak_version) < StrictVersion('1.1.3'):
|
||||
if LooseVersion(flatpak_version) < LooseVersion('1.1.3'):
|
||||
base_command += ["-y"]
|
||||
else:
|
||||
base_command += ["--noninteractive"]
|
||||
|
@ -196,7 +196,7 @@ def uninstall_flat(module, binary, names, method):
|
|||
]
|
||||
command = [binary, "uninstall"]
|
||||
flatpak_version = _flatpak_version(module, binary)
|
||||
if StrictVersion(flatpak_version) < StrictVersion('1.1.3'):
|
||||
if LooseVersion(flatpak_version) < LooseVersion('1.1.3'):
|
||||
command += ["-y"]
|
||||
else:
|
||||
command += ["--noninteractive"]
|
||||
|
|
|
@ -140,7 +140,8 @@ EXAMPLES = '''
|
|||
import os
|
||||
import re
|
||||
import tempfile
|
||||
from distutils import version
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
@ -493,7 +494,7 @@ class HomebrewCask(object):
|
|||
|
||||
def _brew_cask_command_is_deprecated(self):
|
||||
# The `brew cask` replacements were fully available in 2.6.0 (https://brew.sh/2020/12/01/homebrew-2.6.0/)
|
||||
return version.LooseVersion(self._get_brew_version()) >= version.LooseVersion('2.6.0')
|
||||
return LooseVersion(self._get_brew_version()) >= LooseVersion('2.6.0')
|
||||
# /checks ------------------------------------------------------ }}}
|
||||
|
||||
# commands ----------------------------------------------------- {{{
|
||||
|
|
|
@ -97,9 +97,10 @@ RETURN = r''' # '''
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from distutils.version import StrictVersion
|
||||
import os
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
class Mas(object):
|
||||
|
||||
|
@ -145,7 +146,7 @@ class Mas(object):
|
|||
|
||||
# Is the version recent enough?
|
||||
rc, out, err = self.run(['version'])
|
||||
if rc != 0 or not out.strip() or StrictVersion(out.strip()) < StrictVersion('1.5.0'):
|
||||
if rc != 0 or not out.strip() or LooseVersion(out.strip()) < LooseVersion('1.5.0'):
|
||||
self.module.fail_json(msg='`mas` tool in version 1.5.0+ needed, got ' + out.strip())
|
||||
|
||||
def check_signin(self):
|
||||
|
|
|
@ -135,10 +135,10 @@ import re
|
|||
import shlex
|
||||
import sqlite3
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
# Function used for executing commands.
|
||||
def execute_command(cmd, module):
|
||||
|
@ -435,7 +435,7 @@ def parse_package_name(names, pkg_spec, module):
|
|||
if pkg_spec[name]['branch']:
|
||||
branch_release = "6.0"
|
||||
|
||||
if StrictVersion(platform.release()) < StrictVersion(branch_release):
|
||||
if LooseVersion(platform.release()) < LooseVersion(branch_release):
|
||||
module.fail_json(msg="package name using 'branch' syntax requires at least OpenBSD %s: %s" % (branch_release, name))
|
||||
|
||||
# Sanity check that there are no trailing dashes in flavor.
|
||||
|
|
|
@ -133,8 +133,6 @@ except ImportError:
|
|||
XML_IMP_ERR = traceback.format_exc()
|
||||
HAS_XML = False
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
@ -142,6 +140,8 @@ from ansible.module_utils.common.text.converters import to_text
|
|||
from ansible.module_utils.six.moves import configparser, StringIO
|
||||
from io import open
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
REPO_OPTS = ['alias', 'name', 'priority', 'enabled', 'autorefresh', 'gpgcheck']
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ import traceback
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
GITLAB_IMP_ERR = None
|
||||
try:
|
||||
|
|
|
@ -158,11 +158,12 @@ diversion:
|
|||
|
||||
import re
|
||||
import os
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
||||
def diversion_state(module, command, path):
|
||||
diversion = dict(path=path, state='absent', divert=None, holder=None)
|
||||
|
|
|
@ -115,7 +115,6 @@ EXAMPLES = '''
|
|||
fstype: vfat
|
||||
'''
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
|
@ -124,6 +123,8 @@ import stat
|
|||
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.version import LooseVersion
|
||||
|
||||
|
||||
class Device(object):
|
||||
def __init__(self, module, path):
|
||||
|
|
|
@ -56,13 +56,14 @@ pids:
|
|||
|
||||
import abc
|
||||
import re
|
||||
from distutils.version import LooseVersion
|
||||
from os.path import basename
|
||||
|
||||
from ansible.module_utils import six
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
try:
|
||||
import psutil
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ import operator
|
|||
HAS_DISTUTILS = False
|
||||
try:
|
||||
import pkg_resources
|
||||
from distutils.version import LooseVersion
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
HAS_DISTUTILS = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
@ -95,10 +95,11 @@ EXAMPLES = """
|
|||
import os
|
||||
import tempfile
|
||||
import traceback
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
PASSLIB_IMP_ERR = None
|
||||
try:
|
||||
from passlib.apache import HtpasswdFile, htpasswd_context
|
||||
|
|
Loading…
Reference in a new issue