mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Network module code cleanup (#5061)
* Fix imports in junos_template * Python 3 compatibility in eos_command * Python 3 compatibility for ios_command * Clean up issues with ios_facts * Python 3 compatibility for ios_facts * Import shuffle in ios_template * Python 3 compatibility for iosxr_command * Clean up iosxr_facts.py * Python 3 compatibility for iosxr_facts * Python 3 compatibility for junos_command * Python 3 compatibility for ops_command * Cleanup issues with ops_facts * Python 3 compatibility for ops_facts * Cleanup issues with ops_template * Python 3 compatibility for vyos_command * Cleanup issues with vyos_facts * Python 3 compatibility for vyos_facts
This commit is contained in:
parent
6ae0342a0a
commit
aa82f48dc8
12 changed files with 74 additions and 48 deletions
|
@ -158,16 +158,14 @@ xml:
|
|||
type: list
|
||||
sample: [['...', '...'], ['...', '...']]
|
||||
"""
|
||||
import re
|
||||
|
||||
import ansible.module_utils.junos
|
||||
|
||||
|
||||
from ansible.module_utils.basic import get_exception
|
||||
from ansible.module_utils.network import NetworkModule, NetworkError
|
||||
from ansible.module_utils.netcli import CommandRunner
|
||||
from ansible.module_utils.netcli import AddCommandError, FailedConditionsError
|
||||
from ansible.module_utils.junos import xml_to_json
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
VALID_KEYS = {
|
||||
'cli': frozenset(['command', 'output', 'prompt', 'response']),
|
||||
|
@ -177,7 +175,7 @@ VALID_KEYS = {
|
|||
|
||||
def to_lines(stdout):
|
||||
for item in stdout:
|
||||
if isinstance(item, basestring):
|
||||
if isinstance(item, string_types):
|
||||
item = str(item).split('\n')
|
||||
yield item
|
||||
|
||||
|
@ -189,7 +187,7 @@ def parse(module, command_type):
|
|||
|
||||
parsed = list()
|
||||
for item in (items or list()):
|
||||
if isinstance(item, basestring):
|
||||
if isinstance(item, string_types):
|
||||
item = dict(command=item, output=None)
|
||||
elif 'command' not in item:
|
||||
module.fail_json(msg='command keyword argument is required')
|
||||
|
@ -302,4 +300,3 @@ def main():
|
|||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue