Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fail on warnings #358

Closed
XioNoX opened this issue Mar 5, 2015 · 5 comments
Closed

Do not fail on warnings #358

XioNoX opened this issue Mar 5, 2015 · 5 comments

Comments

@XioNoX
Copy link

XioNoX commented Mar 5, 2015

Currently, if for example a load config returns warnings, the whole process will fail.
It would be useful to be able to ignore them.

I think that work kind of started in https://groups.google.com/d/msg/junos-python-ez/S2s0DnT_n3o/whUzKeOsmz4J

@shermdog shermdog added the defer label Mar 5, 2015
@shermdog
Copy link
Contributor

shermdog commented Mar 5, 2015

Hi @XioNoX,

This is under consideration, but we may not change this behavior.
Juniper/py-junos-netconify#19

ncclient passes this back to us as an rpc-error - which is correct per the RFC https://tools.ietf.org/html/rfc4741#section-4.3

We are also only given back the first rpc-error instance from ncclient leopoul/ncclient#54

Because of this, if we were to pass on a warning, it's very likely there could be a nested error we do not see that that should not be passed.

Further more there is larger community to support that generally relies on such guardrails within their automation. We shouldn't be committing bad configs.

-Rick

@XioNoX
Copy link
Author

XioNoX commented Mar 5, 2015

Thanks for your reply, I'll follow that ncclient bug#
I guess that's just a point of view, but all of the warnings I'm getting are more notices than warnings (empty configuration blocks during a load, licences on a commit, etc.), and thus, not bad configs.
A preference to flip (off by default) could be a good way to satisfy both kind of users (who need it strict and not).

In the meantime, knowing all the risks, do you have a pointer or a quick hack to ignore warnings (at least on config load)?

@shermdog
Copy link
Contributor

shermdog commented Mar 5, 2015

You can put the operation in a try/catch and snag the severity from the exception

untested example

except ConfigLoadError as e:
    if e.rpc_error['severity'] == 'warning':
        pass
    else:
        raise

@shermdog
Copy link
Contributor

We should be able to get this into 2.0.0 as the underlying mechanism will be supported in the next release of ncclient.

@vnitinv
Copy link
Contributor

vnitinv commented Jul 15, 2016

We got this out in 1.3.1

@vnitinv vnitinv closed this as completed Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants