Skip to content

Commit ec4ef5f

Browse files
author
Dean Troyer
committed
Suppress warnings user can't fix
Requests/urllib3 started issuing warnings about certificates and SSL that our users are unable to do anything about. This is a very blunt way to suppress these warnings unless --verbose or --debug is supplied on the command line. Being more precise in the suppression requires importing the warning classes from urllib3 and dealing with the platforms where it has been unvendored from requests. Maybe in the future if there are concerns that this mutes too much otherwise. Change-Id: I50bb10a16222de12c5b95bfe042b92e43ea8ee7c
1 parent d5f2c50 commit ec4ef5f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎openstackclient/shell.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2012-2013 OpenStack Foundation
2+
# Copyright 2015 Dean Troyer
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License"); you may
45
# not use this file except in compliance with the License. You may obtain
@@ -19,6 +20,7 @@
1920
import logging
2021
import sys
2122
import traceback
23+
import warnings
2224

2325
from cliff import app
2426
from cliff import command
@@ -139,12 +141,15 @@ def configure_logging(self):
139141
if self.options.verbose_level == 0:
140142
# --quiet
141143
root_logger.setLevel(logging.ERROR)
144+
warnings.simplefilter("ignore")
142145
elif self.options.verbose_level == 1:
143146
# This is the default case, no --debug, --verbose or --quiet
144147
root_logger.setLevel(logging.WARNING)
148+
warnings.simplefilter("ignore")
145149
elif self.options.verbose_level == 2:
146150
# One --verbose
147151
root_logger.setLevel(logging.INFO)
152+
warnings.simplefilter("once")
148153
elif self.options.verbose_level >= 3:
149154
# Two or more --verbose
150155
root_logger.setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)