Skip to content

Commit

Permalink
Fixed rpd module related issue (Juniper#677)
Browse files Browse the repository at this point in the history
When performing an RPC get with an RPC that is not implemented for a platform, it fails when using a PyEZ connection.
With a local connection, the response is “Unable to execute the RPC” and it continues with the next RPC get.
PyEZ behavior should be the same as with the local connection.
  • Loading branch information
dineshbaburam91 authored Jul 17, 2024
1 parent 9075bf5 commit b1aa8c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ansible_collections/juniper/device/plugins/modules/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,14 @@ def main():
resp = junos_module.dev.rpc(rpc,
normalize=bool(format == 'xml'))
else:
resp = junos_module.get_rpc(rpc,
try:
resp = junos_module.get_rpc(rpc,
ignore_warning=ignore_warning, format=format)
except Exception as ex:
if "RpcError" in (str(ex)):
raise junos_module.pyez_exception.RpcError
if "ConnectError" in (str(ex)):
raise junos_module.pyez_exception.ConnectError
result['msg'] = 'The RPC executed successfully.'
junos_module.logger.debug('RPC "%s" executed successfully.',
junos_module.etree.tostring(
Expand Down

0 comments on commit b1aa8c4

Please sign in to comment.