mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
minor clean up of junos_command (#22545)
* removes unneeded check_transport function * removes unneeded global vars * verifies all integration tests are passing
This commit is contained in:
parent
995497129e
commit
09c08e1939
1 changed files with 0 additions and 18 deletions
|
@ -144,7 +144,6 @@ from functools import partial
|
||||||
from xml.etree import ElementTree as etree
|
from xml.etree import ElementTree as etree
|
||||||
from xml.etree.ElementTree import Element, SubElement, tostring
|
from xml.etree.ElementTree import Element, SubElement, tostring
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.junos import junos_argument_spec, check_args
|
from ansible.module_utils.junos import junos_argument_spec, check_args
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.netcli import Conditional, FailedConditionalError
|
from ansible.module_utils.netcli import Conditional, FailedConditionalError
|
||||||
|
@ -160,21 +159,6 @@ except ImportError:
|
||||||
|
|
||||||
USE_PERSISTENT_CONNECTION = True
|
USE_PERSISTENT_CONNECTION = True
|
||||||
|
|
||||||
|
|
||||||
VALID_KEYS = {
|
|
||||||
'cli': frozenset(['command', 'output', 'prompt', 'response']),
|
|
||||||
'rpc': frozenset(['command', 'output'])
|
|
||||||
}
|
|
||||||
|
|
||||||
def check_transport(module):
|
|
||||||
transport = (module.params['provider'] or {}).get('transport')
|
|
||||||
|
|
||||||
if transport == 'netconf' and not module.params['rpcs']:
|
|
||||||
module.fail_json(msg='argument commands is only supported over cli transport')
|
|
||||||
|
|
||||||
elif transport == 'cli' and not module.params['commands']:
|
|
||||||
module.fail_json(msg='argument rpcs is only supported over netconf transport')
|
|
||||||
|
|
||||||
def to_lines(stdout):
|
def to_lines(stdout):
|
||||||
lines = list()
|
lines = list()
|
||||||
for item in stdout:
|
for item in stdout:
|
||||||
|
@ -314,8 +298,6 @@ def main():
|
||||||
required_one_of=required_one_of,
|
required_one_of=required_one_of,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
check_transport(module)
|
|
||||||
|
|
||||||
warnings = list()
|
warnings = list()
|
||||||
check_args(module, warnings)
|
check_args(module, warnings)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue