napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

warning raise exception: add ignore_warning as optional_arg #179

Closed sincerywaing closed 7 years ago

sincerywaing commented 7 years ago

Description of Issue/Question

if we delete a command that does not exist, program will raise exception and load set will fail. warning: statement not found warning: statement not found warning: statement not found

however in pyez we can use ignore_warning to ignore any warning. Can we add this?

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

[* ] Yes [ ] No

Setup

napalm-junos version

(Paste verbatim output from pip freeze | grep napalm-junos between quotes below)

napalm-junos==0.10.3

JunOS version

(Paste verbatim output from show version and haiku between quotes below)

any junos

Steps to Reproduce the Issue

delete some command that does not exist

Error Traceback

(Paste the complete traceback of the exception between quotes below)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/utils/config.py", line 518, in load
    ignore_warning=ignore_warning)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/utils/config.py", line 439, in try_load
    raise ConfigLoadError(cmd=err.cmd, rsp=err.rsp, errs=err.errs)
jnpr.junos.exception.ConfigLoadError: ConfigLoadError(severity: error, bad_element: routing-inst, message: warning: statement not found
warning: statement not found
warning: statement not found
warning: statement not found
warning: statement not found
error: syntax error
warning: statement not found: next-table
warning: statement not found
warning: statement not found
dbarrosop commented 7 years ago

I guess we can add an optional_arg to the driver. Is this something you could look into and send a PR?

sincerywaing commented 7 years ago

@dbarrosop I created a pull request to develop branch to add ignore_warning as optional_args. Please take a look.

mirceaulinic commented 7 years ago

This feature will be included in napalm-junos 0.11.0.