Add a test on jnpr.junos.utils.sw presence (#3666)
This commit is contained in:
parent
2042d948db
commit
abfc8d36a8
1 changed files with 8 additions and 1 deletions
|
@ -93,7 +93,11 @@ EXAMPLES = """
|
||||||
reboot: no
|
reboot: no
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from jnpr.junos.utils.sw import SW
|
try:
|
||||||
|
from jnpr.junos.utils.sw import SW
|
||||||
|
HAS_SW = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_SW = False
|
||||||
|
|
||||||
def install_package(module):
|
def install_package(module):
|
||||||
junos = SW(module.connection.device)
|
junos = SW(module.connection.device)
|
||||||
|
@ -126,6 +130,9 @@ def main():
|
||||||
module = get_module(argument_spec=spec,
|
module = get_module(argument_spec=spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
|
if not HAS_SW:
|
||||||
|
module.fail_json(msg='Missing jnpr.junos.utils.sw module')
|
||||||
|
|
||||||
result = dict(changed=False)
|
result = dict(changed=False)
|
||||||
|
|
||||||
do_upgrade = module.params['force'] or False
|
do_upgrade = module.params['force'] or False
|
||||||
|
|
Loading…
Reference in a new issue