summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2015-03-18 10:25:31 -0500
committerDean Troyer <dtroyer@gmail.com>2015-04-02 12:59:34 -0500
commitec4ef5f5ba0b5aada506fd979f10e36c2b35a0f6 (patch)
tree78b54b7132854affa865097c8acc6607f2f8d691 /openstackclient
parentd5f2c50c0f2de6d741f86113fc5260bdb7895102 (diff)
downloadpython-openstackclient-ec4ef5f5ba0b5aada506fd979f10e36c2b35a0f6.tar.gz
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
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/shell.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 3cfd7312..172c0312 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -1,4 +1,5 @@
# Copyright 2012-2013 OpenStack Foundation
+# Copyright 2015 Dean Troyer
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -19,6 +20,7 @@ import getpass
import logging
import sys
import traceback
+import warnings
from cliff import app
from cliff import command
@@ -139,12 +141,15 @@ class OpenStackShell(app.App):
if self.options.verbose_level == 0:
# --quiet
root_logger.setLevel(logging.ERROR)
+ warnings.simplefilter("ignore")
elif self.options.verbose_level == 1:
# This is the default case, no --debug, --verbose or --quiet
root_logger.setLevel(logging.WARNING)
+ warnings.simplefilter("ignore")
elif self.options.verbose_level == 2:
# One --verbose
root_logger.setLevel(logging.INFO)
+ warnings.simplefilter("once")
elif self.options.verbose_level >= 3:
# Two or more --verbose
root_logger.setLevel(logging.DEBUG)