ios_static_route: fix broken import (#34133)
* Fix broken import * doc: add ipaddress in requirements
This commit is contained in:
parent
7b260eaafe
commit
459adf8966
2 changed files with 11 additions and 2 deletions
|
@ -35,6 +35,8 @@ description:
|
|||
IP routes on Cisco IOS network devices.
|
||||
notes:
|
||||
- Tested against IOS 15.6
|
||||
requirements:
|
||||
- Python >= 3.3 or C(ipaddress) python package
|
||||
options:
|
||||
prefix:
|
||||
description:
|
||||
|
@ -102,9 +104,14 @@ from ansible.module_utils.connection import exec_command
|
|||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
from ansible.module_utils.network.ios.ios import load_config, run_commands
|
||||
from ansible.module_utils.network.ios.ios import ios_argument_spec, check_args
|
||||
from ipaddress import ip_network
|
||||
import re
|
||||
|
||||
try:
|
||||
from ipaddress import ip_network
|
||||
HAS_IPADDRESS = True
|
||||
except ImportError:
|
||||
HAS_IPADDRESS = False
|
||||
|
||||
|
||||
def map_obj_to_commands(updates, module):
|
||||
commands = list()
|
||||
|
@ -216,6 +223,9 @@ def main():
|
|||
mutually_exclusive=mutually_exclusive,
|
||||
supports_check_mode=True)
|
||||
|
||||
if not HAS_IPADDRESS:
|
||||
module.fail_json(msg="ipaddress python package is required")
|
||||
|
||||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ lib/ansible/modules/cloud/webfaction/webfaction_db.py
|
|||
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
||||
lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py
|
||||
lib/ansible/modules/cloud/webfaction/webfaction_site.py
|
||||
lib/ansible/modules/network/ios/ios_static_route.py
|
||||
lib/ansible/modules/network/lenovo/cnos_backup.py
|
||||
lib/ansible/modules/network/lenovo/cnos_bgp.py
|
||||
lib/ansible/modules/network/lenovo/cnos_command.py
|
||||
|
|
Loading…
Reference in a new issue