Add a test on jnpr.junos.utils.sw presence (#3666)

This commit is contained in:
Michael Scherer 2016-05-17 19:04:16 +02:00 committed by Matt Clay
parent 2042d948db
commit abfc8d36a8

View file

@ -93,7 +93,11 @@ EXAMPLES = """
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):
junos = SW(module.connection.device)
@ -126,6 +130,9 @@ def main():
module = get_module(argument_spec=spec,
supports_check_mode=True)
if not HAS_SW:
module.fail_json(msg='Missing jnpr.junos.utils.sw module')
result = dict(changed=False)
do_upgrade = module.params['force'] or False