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:
Chaitanya Deshpande 2019-05-17 22:42:06 +05:30 committed by Nathaniel Case
parent 63e33f7e71
commit b5935486da
72 changed files with 2906 additions and 980 deletions

View file

@ -46,9 +46,6 @@ options:
- It will automatically disable old production pools once there is a new production candidate.
- Default value when not specified in API or module is interpreted by Avi Controller as True.
type: bool
cloud_ref:
description:
- It is a reference to an object of type cloud.
description:
description:
- User defined description for the object.
@ -57,7 +54,6 @@ options:
- Duration of evaluation period for automatic deployment.
- Allowed values are 60-86400.
- Default value when not specified in API or module is interpreted by Avi Controller as 300.
- Units(SEC).
name:
description:
- The name of the pool group deployment policy.
@ -75,7 +71,6 @@ options:
- Target traffic ratio before pool is made production.
- Allowed values are 1-100.
- Default value when not specified in API or module is interpreted by Avi Controller as 100.
- Units(RATIO).
tenant_ref:
description:
- It is a reference to an object of type tenant.
@ -121,7 +116,7 @@ obj:
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.network.avi.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
avi_common_argument_spec, avi_ansible_api, HAS_AVI)
except ImportError:
HAS_AVI = False
@ -134,7 +129,6 @@ def main():
choices=['put', 'patch']),
avi_api_patch_op=dict(choices=['add', 'replace', 'delete']),
auto_disable_old_prod_pools=dict(type='bool',),
cloud_ref=dict(type='str',),
description=dict(type='str',),
evaluation_duration=dict(type='int',),
name=dict(type='str', required=True),
@ -152,7 +146,7 @@ def main():
argument_spec=argument_specs, supports_check_mode=True)
if not HAS_AVI:
return module.fail_json(msg=(
'Avi python API SDK (avisdk>=17.1) is not installed. '
'Avi python API SDK (avisdk>=17.1) or requests is not installed. '
'For more details visit https://github.com/avinetworks/sdk.'))
return avi_ansible_api(module, 'poolgroupdeploymentpolicy',
set([]))