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

@ -41,6 +41,21 @@ options:
- Patch operation to use when using avi_api_update_method as patch.
version_added: "2.5"
choices: ["add", "replace", "delete"]
aws_access_key:
description:
- Aws access key id.
- Field introduced in 18.2.3.
version_added: "2.9"
aws_bucket_id:
description:
- Aws bucket.
- Field introduced in 18.2.3.
version_added: "2.9"
aws_secret_access:
description:
- Aws secret access key.
- Field introduced in 18.2.3.
version_added: "2.9"
backup_file_prefix:
description:
- Prefix of the exported configuration file.
@ -78,6 +93,12 @@ options:
description:
- Remote backup.
type: bool
upload_to_s3:
description:
- Cloud backup.
- Field introduced in 18.2.3.
version_added: "2.9"
type: bool
url:
description:
- Avi controller URL of the object.
@ -108,7 +129,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
@ -120,6 +141,9 @@ def main():
avi_api_update_method=dict(default='put',
choices=['put', 'patch']),
avi_api_patch_op=dict(choices=['add', 'replace', 'delete']),
aws_access_key=dict(type='str', no_log=True,),
aws_bucket_id=dict(type='str',),
aws_secret_access=dict(type='str', no_log=True,),
backup_file_prefix=dict(type='str',),
backup_passphrase=dict(type='str', no_log=True,),
maximum_backups_stored=dict(type='int',),
@ -130,6 +154,7 @@ def main():
ssh_user_ref=dict(type='str',),
tenant_ref=dict(type='str',),
upload_to_remote_host=dict(type='bool',),
upload_to_s3=dict(type='bool',),
url=dict(type='str',),
uuid=dict(type='str',),
)
@ -138,10 +163,10 @@ 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, 'backupconfiguration',
set(['backup_passphrase']))
set(['backup_passphrase', 'aws_access_key', 'aws_secret_access']))
if __name__ == '__main__':