Skip to content

dev.cli doesn't raise an exception incase of incorrect command #925

@rsmekala

Description

@rsmekala

Question

@vnitinv Is there a reason this doesn't happen in PyEZ ??

Current behavior

When the user enters an incorrect RPC, an exception is raised:

Traceback (most recent call last):
  File "/Users/rsmekala/PycharmProjects/salt/tmp/wrongCLICommand.py", line 4, in <module>
    print(dev.rpc.get_test())
  File "/Users/rsmekala/PycharmProjects/salt/venv/lib/python2.7/site-packages/jnpr/junos/rpcmeta.py", line 345, in _exec_rpc
    return self._junos.execute(rpc, **dec_args)
  File "/Users/rsmekala/PycharmProjects/salt/venv/lib/python2.7/site-packages/jnpr/junos/decorators.py", line 76, in wrapper
    return function(*args, **kwargs)
  File "/Users/rsmekala/PycharmProjects/salt/venv/lib/python2.7/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
    return function(*args, **kwargs)
  File "/Users/rsmekala/PycharmProjects/salt/venv/lib/python2.7/site-packages/jnpr/junos/device.py", line 794, in execute
    errs=ex)
jnpr.junos.exception.RpcError: RpcError(severity: error, bad_element: get-test, message: syntax error)

There is no exception raised in case of invalid CLI command. Currently, it just prints the output as though the command has executed successfully.

invalid command: show test: RpcError(severity: error, bad_element: test, message: syntax error, expecting <command>)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions