Fixes tests in bigip_wait for ansible 2.8 (#47773)
This commit is contained in:
parent
38844194ae
commit
7c84ba8051
2 changed files with 27 additions and 19 deletions
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Copyright: (c) 2017, F5 Networks Inc.
|
||||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -48,6 +49,7 @@ author:
|
|||
EXAMPLES = r'''
|
||||
- name: Wait for BIG-IP to be ready to take configuration
|
||||
bigip_wait:
|
||||
provider:
|
||||
password: secret
|
||||
server: lb.mydomain.com
|
||||
user: admin
|
||||
|
@ -56,6 +58,7 @@ EXAMPLES = r'''
|
|||
- name: Wait a maximum of 300 seconds for BIG-IP to be ready to take configuration
|
||||
bigip_wait:
|
||||
timeout: 300
|
||||
provider:
|
||||
password: secret
|
||||
server: lb.mydomain.com
|
||||
user: admin
|
||||
|
@ -64,6 +67,7 @@ EXAMPLES = r'''
|
|||
- name: Wait for BIG-IP to be ready, don't start checking for 10 seconds
|
||||
bigip_wait:
|
||||
delay: 10
|
||||
provider:
|
||||
password: secret
|
||||
server: lb.mydomain.com
|
||||
user: admin
|
||||
|
|
|
@ -8,32 +8,36 @@ __metaclass__ = type
|
|||
|
||||
import os
|
||||
import json
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from nose.plugins.skip import SkipTest
|
||||
if sys.version_info < (2, 7):
|
||||
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||
|
||||
from units.compat import unittest
|
||||
from units.compat.mock import Mock
|
||||
from units.compat.mock import patch
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.modules.bigip_wait import Parameters
|
||||
from library.modules.bigip_wait import ModuleManager
|
||||
from library.modules.bigip_wait import ArgumentSpec
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
from test.unit.modules.utils import set_module_args
|
||||
|
||||
# In Ansible 2.8, Ansible changed import paths.
|
||||
from test.units.compat import unittest
|
||||
from test.units.compat.mock import Mock
|
||||
from test.units.compat.mock import patch
|
||||
|
||||
from test.units.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
try:
|
||||
from ansible.modules.network.f5.bigip_wait import Parameters
|
||||
from ansible.modules.network.f5.bigip_wait import ModuleManager
|
||||
from ansible.modules.network.f5.bigip_wait import ArgumentSpec
|
||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||
|
||||
# Ansible 2.8 imports
|
||||
from units.compat import unittest
|
||||
from units.compat.mock import Mock
|
||||
from units.compat.mock import patch
|
||||
|
||||
from units.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||
|
|
Loading…
Reference in a new issue