mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Renamed the avi_ansible_utils to avi. Fixed the import error and clea… (#22112)
* Renamed the avi_ansible_utils to avi. Fixed the import error and cleaned up code. * Refactored all new modules to use the new module_utils.avi * Added module_utils.avi to python 2.4 skip list
This commit is contained in:
parent
7ab0f28e80
commit
61288b14fd
18 changed files with 31 additions and 110 deletions
|
@ -29,10 +29,10 @@
|
|||
|
||||
# This module initially matched the namespace of network module avi. However,
|
||||
# that causes namespace import error when other modules from avi namespaces
|
||||
# are imported. In order to avoid the import collisions this was renamed to
|
||||
# avi_ansible_utils to allow this module to be ceterpiece of all integration
|
||||
# with external avi modules.
|
||||
# are imported. Added import of absolute_import to avoid import collisions for
|
||||
# avi.sdk.
|
||||
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
from pkg_resources import parse_version
|
||||
|
|
@ -389,19 +389,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from copy import deepcopy
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, ansible_return, HAS_AVI)
|
||||
from avi.sdk.avi_api import ApiSession
|
||||
from avi.sdk.utils.ansible_utils import avi_obj_cmp, cleanup_absent_fields
|
||||
|
|
|
@ -113,19 +113,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -152,19 +152,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -83,19 +83,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ obj:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
|
|
@ -89,19 +89,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -99,19 +99,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ obj:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
|
|
@ -112,7 +112,7 @@ obj:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
|
|
@ -79,19 +79,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ obj:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
|
|
@ -150,19 +150,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ extends_documentation_fragment:
|
|||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- name: Example Adds/Deletes SystemConfiguration configuration from Avi Controller
|
||||
- name: Example to create SystemConfiguration object
|
||||
avi_systemconfiguration:
|
||||
controller: 10.10.25.42
|
||||
username: admin
|
||||
|
@ -122,19 +122,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -91,19 +91,11 @@ obj:
|
|||
type: dict
|
||||
'''
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.avi import avi_common_argument_spec
|
||||
|
||||
HAS_AVI = True
|
||||
try:
|
||||
import avi.sdk
|
||||
sdk_version = getattr(avi.sdk, '__version__', None)
|
||||
if ((sdk_version is None) or (sdk_version and
|
||||
(parse_version(sdk_version) < parse_version('16.3.5.post1')))):
|
||||
# It allows the __version__ to be '' as that value is used in development builds
|
||||
raise ImportError
|
||||
from avi.sdk.utils.ansible_utils import avi_ansible_api
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ obj:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.avi_ansible_utils import (
|
||||
from ansible.module_utils.avi import (
|
||||
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
/lib/ansible/modules/web_infrastructure/ansible_tower/
|
||||
/lib/ansible/module_utils/a10.py
|
||||
/lib/ansible/module_utils/ansible_tower.py
|
||||
/lib/ansible/module_utils/avi.py
|
||||
/lib/ansible/module_utils/azure_rm_common.py
|
||||
/lib/ansible/module_utils/cloud.py
|
||||
/lib/ansible/module_utils/docker_common.py
|
||||
|
|
Loading…
Reference in a new issue