mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
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:
committed by
John R Barker
parent
2f2e792cae
commit
6df5f89763
@@ -27,7 +27,26 @@
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# 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.
|
||||
|
||||
import os
|
||||
from pkg_resources import parse_version
|
||||
|
||||
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
|
||||
except ImportError:
|
||||
HAS_AVI = False
|
||||
|
||||
|
||||
def avi_common_argument_spec():
|
||||
Reference in New Issue
Block a user