Added check for avi SDK version as suggested in review. (#21927)

* Added check for avi SDK version as suggested in review.

* Fixed documentation based on review.

* Renamed module_utils.avi to module_utils.avi_ansible_utils
as import of avi.sdk would fail due to name collisions.

Moved the code to check for AVI version into the ansible modules.

* Updated the module with note about reason for name change.
This commit is contained in:
Gaurav Rastogi 2017-02-28 11:21:20 -08:00 committed by John R Barker
commit 6df5f89763
7 changed files with 37 additions and 28 deletions

View file

@ -128,12 +128,10 @@ obj:
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.avi import avi_common_argument_spec
HAS_AVI = True
try:
from avi.sdk.utils.ansible_utils import avi_ansible_api
from ansible.module_utils.avi_ansible_utils import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:
HAS_AVI = False
@ -164,7 +162,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) is not installed. '
'Avi python API SDK (avisdk>=16.3.5.post1) is not installed. '
'For more details visit https://github.com/avinetworks/sdk.'))
return avi_ansible_api(module, 'sslkeyandcertificate',
set(['key']))