Skip to content

Commit

Permalink
Allow to ignore selected urllib3 warnings
Browse files Browse the repository at this point in the history
Bug: T158758
Change-Id: I0f1e1891e692af10efe3977b87f7bfa5de0abec9
  • Loading branch information
volans- committed Feb 24, 2017
1 parent e18af3f commit ac177e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cumin/backends/puppetdb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import requests

from requests.packages import urllib3

from cumin.backends import BaseQuery, InvalidQueryError


Expand Down Expand Up @@ -28,6 +30,9 @@ def __init__(self, config, logger=None):
host=puppetdb_config.get('host', 'localhost'),
port=puppetdb_config.get('port', 443))

for exception in puppetdb_config.get('urllib3_disable_warnings', []):
urllib3.disable_warnings(category=getattr(urllib3.exceptions, exception))

@property
def category(self):
"""Getter for the property category with a default value"""
Expand Down
2 changes: 2 additions & 0 deletions doc/examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ log_file: logs/cumin.log # Absolute or relative path for the log file
puppetdb:
host: puppetdb.local
port: 443
urllib3_disable_warnings: # List of Python urllib3 exceptions to ignore
- SubjectAltNameWarning

# Transport-specific configuration
clustershell:
Expand Down

0 comments on commit ac177e8

Please sign in to comment.