mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Updated utils to remove Avi SDK dependency and Avi 18.2.2 version update (#54894)
* Updated utils to remove Avi SDK dependency and Avi 18.2.2 version update * Fixed the python 3.x errors failing for avi_disable_session_cache_as_fact not properly documented * Updated version added fields for new parameters * fixed pep8 errors * made requests import optional * removed setting requests to None * Added try catch for the avi helper methods such that any import fails then module fail gracefully. This was needed to pass the requests library not found error * removed deprecated modules. Also, trying another fix to deal with requests import error * Fixed python3 errors * fixed pep8, no-dict-iteritems and import test failures * added version 2.8 for new field * some more code cleanup and formatting * updated the fail message and fixed plint errors * added workaround for unicode pylint * fixed the version added for new parameter app_learning_memory_percent and removed unicode_literals import * Removed check of HAS_AVI for common argument spec * Updated version added value from 2.8 to 2.9 * Version added value fixes of CI error
This commit is contained in:
committed by
Nathaniel Case
parent
63e33f7e71
commit
b5935486da
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
# Created on July 24, 2017
|
||||
#
|
||||
@@ -7,12 +6,13 @@
|
||||
#
|
||||
# module_check: not supported
|
||||
#
|
||||
# Copyright: (c) 2017, Gaurav Rastogi <grastogi@avinetworks.com>
|
||||
# Copyright: (c) 2017, Vilian Atmadzhov <vilian.atmadzhov@paddypowerbetfair.com>
|
||||
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
|
||||
# Vilian Atmadzhov, <vilian.atmadzhov@paddypowerbetfair.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
#
|
||||
"""
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
@@ -21,7 +21,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: avi_api_version
|
||||
author: Vilian Atmadzhov (@grastogi23) <vilian.atmadzhov@paddypowerbetfair.com>
|
||||
author: Vilian Atmadzhov (@vivobg) <vilian.atmadzhov@paddypowerbetfair.com>
|
||||
|
||||
short_description: Avi API Version Module
|
||||
description:
|
||||
@@ -55,17 +55,20 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from ansible.module_utils.network.avi.avi import (
|
||||
avi_common_argument_spec, HAS_AVI)
|
||||
from avi.sdk.avi_api import ApiSession, AviCredentials
|
||||
avi_common_argument_spec, ansible_return, HAS_AVI)
|
||||
from ansible.module_utils.network.avi.avi_api import (
|
||||
ApiSession, AviCredentials)
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(argument_spec=avi_common_argument_spec())
|
||||
argument_specs = dict()
|
||||
argument_specs.update(avi_common_argument_spec())
|
||||
module = AnsibleModule(argument_spec=argument_specs)
|
||||
if not HAS_AVI:
|
||||
return module.fail_json(msg=(
|
||||
'Avi python API SDK (avisdk) is not installed. '
|
||||
'Avi python API SDK (avisdk>=17.1) or requests is not installed. '
|
||||
'For more details visit https://github.com/avinetworks/sdk.'))
|
||||
try:
|
||||
api_creds = AviCredentials()
|
||||
@@ -84,7 +87,7 @@ def main():
|
||||
api.close()
|
||||
module.exit_json(changed=False, obj=remote)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Unable to get an AVI session. {0}".format(e))
|
||||
module.fail_json(msg=("Unable to get an AVI session. %s" % e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user