1
0
Fork 0
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:
Gaurav Rastogi 2017-03-01 08:16:59 -08:00 committed by John R Barker
parent 7ab0f28e80
commit 61288b14fd
18 changed files with 31 additions and 110 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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