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

Disable insecure warning when explicit --nochkcert option given #3

Closed
billdodd opened this issue Jul 27, 2017 · 2 comments
Closed

Disable insecure warning when explicit --nochkcert option given #3

billdodd opened this issue Jul 27, 2017 · 2 comments

Comments

@billdodd
Copy link
Contributor

For the case of running against a system that uses a self-signed cert, several tools have an option (like --nochkcert) to disable the certificate validation. But when you use that option, you will see the following warning displayed:

InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.

If you've explicitly used the --nochkcert option, the warning is just an annoyance. Suggest we disable that warning during arg processing if --nochkcert is specified.

Code to do this:

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

    ...
    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
    ...

Applies to some other tools as well, including Redfish-Service-Validator, Redfish-Interop-Validator and Redfish-Usecase-Checkers/one_time_boot.

Idea came from Paul Vancil who did this in Redfish tool.

@tomasg2012
Copy link
Contributor

Yeah, I've noticed this but it happens differently on certain versions of requests or python, it seems when I see this on a more recent library, it repeats it constantly, which produces a lot of log spam. On the version I'm developing with, it only prints once...

Thanks for the code, I saw a similar question online but with a lot of odd dispute that I never returned to reading about.

@mraineri
Copy link
Collaborator

mraineri commented Aug 3, 2017

Fixed in latest PR

@mraineri mraineri closed this as completed Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants