mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove xml return for junos declarative modules (#26400)
* Remove xml return * Add diff return * Related doc changes
This commit is contained in:
parent
c1ac55147f
commit
1a9b0ae731
13 changed files with 62 additions and 119 deletions
|
@ -107,22 +107,9 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device.
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- interface 20
|
||||
- name test-interface
|
||||
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: C(rpc) is returned only for junos device
|
||||
when configuration is changed on device
|
||||
type: string
|
||||
sample: >
|
||||
<interfaces>
|
||||
<interface>
|
||||
<name>ge-0/0/0</name>
|
||||
<description>test interface</description>
|
||||
</interface>
|
||||
</interfaces>
|
||||
"""
|
||||
|
|
|
@ -82,7 +82,7 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- set interfaces bonding bond0
|
||||
|
|
|
@ -101,16 +101,13 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: >
|
||||
<system>
|
||||
<login>
|
||||
<message>this is my login banner</message>
|
||||
</login>
|
||||
</system>"
|
||||
[edit system login]
|
||||
+ message \"this is my login banner\";
|
||||
"""
|
||||
import collections
|
||||
|
||||
|
@ -182,8 +179,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff},
|
||||
'rpc': tostring(ele)
|
||||
'diff': diff,
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -129,17 +129,15 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: >
|
||||
<interfaces>
|
||||
<interface>
|
||||
<name>ge-0/0/0</name>
|
||||
<description>test interface</description>
|
||||
</interface>
|
||||
</interfaces>
|
||||
[edit interfaces]
|
||||
+ ge-0/0/1 {
|
||||
+ description test-interface;
|
||||
+ }
|
||||
"""
|
||||
import collections
|
||||
|
||||
|
@ -240,8 +238,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff},
|
||||
'rpc': tostring(ele)
|
||||
'diff': diff,
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -111,18 +111,17 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: >
|
||||
<system>
|
||||
<syslog>
|
||||
<console replace=\"replace\" active=\"active\">
|
||||
<name>pfe</name><error/>
|
||||
</console>
|
||||
</syslog>
|
||||
</system>
|
||||
[edit system syslog]
|
||||
+ [edit system syslog]
|
||||
file interactive-commands { ... }
|
||||
+ file test {
|
||||
+ pfe critical;
|
||||
+ }
|
||||
"""
|
||||
import collections
|
||||
|
||||
|
@ -186,11 +185,8 @@ def main():
|
|||
('dest', 'user', ['name', 'facility', 'level']),
|
||||
('dest', 'console', ['facility', 'level'])]
|
||||
|
||||
mutually_exclusive = [('console', 'name')]
|
||||
|
||||
module = AnsibleModule(argument_spec=argument_spec,
|
||||
required_if=required_if,
|
||||
mutually_exclusive=mutually_exclusive,
|
||||
supports_check_mode=True)
|
||||
|
||||
warnings = list()
|
||||
|
@ -240,8 +236,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff},
|
||||
'rpc': tostring(ele)
|
||||
'diff': diff,
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -100,17 +100,18 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: >
|
||||
<interfaces>
|
||||
<interface>
|
||||
<name>ge-0/0/0</name>
|
||||
<description>test interface</description>
|
||||
</interface>
|
||||
</interfaces>
|
||||
[edit system]
|
||||
+ host-name test;
|
||||
+ domain-name ansible.com;
|
||||
+ domain-search redhat.com;
|
||||
[edit system name-server]
|
||||
172.26.1.1 { ... }
|
||||
+ 8.8.8.8;
|
||||
"""
|
||||
import collections
|
||||
|
||||
|
@ -190,8 +191,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff},
|
||||
'rpc': tostring(ele)
|
||||
'diff': diff,
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -118,6 +118,16 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: >
|
||||
[edit system login]
|
||||
+ user test-user {
|
||||
+ uid 2005;
|
||||
+ class read-only;
|
||||
+ }
|
||||
"""
|
||||
from functools import partial
|
||||
|
||||
|
@ -265,7 +275,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff}
|
||||
'diff': diff
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -98,11 +98,15 @@ EXAMPLES = """
|
|||
"""
|
||||
|
||||
RETURN = """
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
diff:
|
||||
description: Configuration difference before and after applying change.
|
||||
returned: when configuration is changed.
|
||||
type: string
|
||||
sample: "<vlans><vlan><name>test-vlan-4</name></vlan></vlans>"
|
||||
sample: >
|
||||
[edit vlans]
|
||||
+ test-vlan-1 {
|
||||
+ vlan-id 60;
|
||||
+ }
|
||||
"""
|
||||
import collections
|
||||
|
||||
|
@ -181,8 +185,7 @@ def main():
|
|||
if diff:
|
||||
result.update({
|
||||
'changed': True,
|
||||
'diff': {'prepared': diff},
|
||||
'rpc': tostring(ele)
|
||||
'diff': diff,
|
||||
})
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
|
@ -76,16 +76,9 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- vlan 20
|
||||
- name test-vlan
|
||||
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: C(rpc) is returned only for junos device
|
||||
when configuration is changed on device
|
||||
type: string
|
||||
sample: "<vlans><vlan><name>test-vlan-4</name></vlan></vlans>"
|
||||
"""
|
||||
|
|
|
@ -67,7 +67,7 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- vrf definition MANAGEMENT
|
||||
|
|
|
@ -78,22 +78,11 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- banner login
|
||||
- this is my login banner
|
||||
- that contains a multiline
|
||||
- string
|
||||
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: when configuration is changed on device
|
||||
type: string
|
||||
sample: >
|
||||
<system>
|
||||
<login>
|
||||
<message>this is my login banner</message>
|
||||
</login>
|
||||
</system>"
|
||||
"""
|
||||
|
|
|
@ -84,22 +84,8 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- logging console critical
|
||||
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: C(rpc) is returned only for junos device
|
||||
when configuration is changed on device
|
||||
type: string
|
||||
sample: >
|
||||
<system>
|
||||
<syslog>
|
||||
<console replace=\"replace\" active=\"active\">
|
||||
<name>pfe</name><error/>
|
||||
</console>
|
||||
</syslog>
|
||||
</system>
|
||||
"""
|
||||
|
|
|
@ -102,22 +102,9 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
commands:
|
||||
description: The list of configuration mode commands to send to the device
|
||||
returned: always
|
||||
returned: always, except for the platforms that use Netconf transport to manage the device.
|
||||
type: list
|
||||
sample:
|
||||
- hostname ios01
|
||||
- ip domain name test.example.com
|
||||
|
||||
rpc:
|
||||
description: load-configuration RPC send to the device
|
||||
returned: C(rpc) is returned only for junos device
|
||||
when configuration is changed on device
|
||||
type: string
|
||||
sample: >
|
||||
<interfaces>
|
||||
<interface>
|
||||
<name>ge-0/0/0</name>
|
||||
<description>test interface</description>
|
||||
</interface>
|
||||
</interfaces>
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue