mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix various junos errors (#23278)
This commit is contained in:
parent
0b8ca98c48
commit
e8538213fa
4 changed files with 7 additions and 7 deletions
|
@ -246,7 +246,7 @@ def parse_rpcs(module):
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def parse_commands(module):
|
def parse_commands(module, warnings):
|
||||||
items = list()
|
items = list()
|
||||||
|
|
||||||
for command in (module.params['commands'] or list()):
|
for command in (module.params['commands'] or list()):
|
||||||
|
@ -301,7 +301,7 @@ def main():
|
||||||
check_args(module, warnings)
|
check_args(module, warnings)
|
||||||
|
|
||||||
items = list()
|
items = list()
|
||||||
items.extend(parse_commands(module))
|
items.extend(parse_commands(module, warnings))
|
||||||
items.extend(parse_rpcs(module))
|
items.extend(parse_rpcs(module))
|
||||||
|
|
||||||
wait_for = module.params['wait_for'] or list()
|
wait_for = module.params['wait_for'] or list()
|
||||||
|
|
|
@ -194,7 +194,7 @@ def check_args(module, warnings):
|
||||||
if module.params['replace'] is not None:
|
if module.params['replace'] is not None:
|
||||||
module.fail_json(msg='argument replace is deprecated, use update')
|
module.fail_json(msg='argument replace is deprecated, use update')
|
||||||
|
|
||||||
zeroize = lambda x: send_request(x, Element('request-system-zeroize'))
|
zeroize = lambda x: send_request(x, ElementTree.Element('request-system-zeroize'))
|
||||||
rollback = lambda x: get_diff(x)
|
rollback = lambda x: get_diff(x)
|
||||||
|
|
||||||
def guess_format(config):
|
def guess_format(config):
|
||||||
|
|
|
@ -65,7 +65,7 @@ ansible_facts:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from xml.etree.ElementTree import Element, SubElement
|
from xml.etree.ElementTree import Element, SubElement, tostring
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
@ -89,7 +89,7 @@ class FactsBase(object):
|
||||||
reply = command(self.module, command)
|
reply = command(self.module, command)
|
||||||
output = reply.find('.//output')
|
output = reply.find('.//output')
|
||||||
if not output:
|
if not output:
|
||||||
module.fail_json(msg='failed to retrieve facts for command %s' % command)
|
self.module.fail_json(msg='failed to retrieve facts for command %s' % command)
|
||||||
return str(output.text).strip()
|
return str(output.text).strip()
|
||||||
|
|
||||||
def rpc(self, rpc):
|
def rpc(self, rpc):
|
||||||
|
|
|
@ -119,7 +119,7 @@ from functools import partial
|
||||||
from ncclient.xml_ import new_ele, sub_ele, to_xml
|
from ncclient.xml_ import new_ele, sub_ele, to_xml
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.junos import load
|
from ansible.module_utils.junos import load_config
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
ROLES = ['operator', 'read-only', 'super-user', 'unauthorized']
|
ROLES = ['operator', 'read-only', 'super-user', 'unauthorized']
|
||||||
|
@ -242,7 +242,7 @@ def main():
|
||||||
if module.params['purge']:
|
if module.params['purge']:
|
||||||
kwargs['action'] = 'replace'
|
kwargs['action'] = 'replace'
|
||||||
|
|
||||||
diff = load(module, ele, **kwargs)
|
diff = load_config(module, ele, **kwargs)
|
||||||
|
|
||||||
if diff:
|
if diff:
|
||||||
result.update({
|
result.update({
|
||||||
|
|
Loading…
Reference in a new issue