summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2023-02-20 17:02:00 +0000
committerStephen Finucane <sfinucan@redhat.com>2023-04-11 16:45:56 +0200
commit23da7b73a285543745d4ea77aad4286ad59d474e (patch)
tree0ffc36f1872c6b250505b0310fcbdc00639e8605
parent864f51f427c01d13c8408782dd03be4b473f7b2e (diff)
downloadpython-openstackclient-23da7b73a285543745d4ea77aad4286ad59d474e.tar.gz
Silence warnings from openstacksdk
OSC has historically relied on project-specific clients like novaclient for library bindings. These did not support auto-negotiation of versions. Instead, users were advised to set the requested microversion to e.g. '2.latest' to opt into the latest API version supported by the client. We're slowly migrating everything to SDK which *does* support auto-negotiation (well, of sorts). This makes versions like '2.latest' unecessary and SDK correctly warns the user about this. You have a configured API_VERSION with 'latest' in it. In the context of openstacksdk this doesn't make any sense. Unfortunately, we have not yet migrated all commands to SDK, meaning we have a mix of SDK and legacy client-based commands. So long as there are any command using the legacy client, we can't insist on users removing this configuration. This makes the warning both annoying and something the user can't do anything about. We also don't want to remove the warning from SDK so instead we opt to filter it out, along with all other warnings from openstacksdk (which similarly a user can't do anything about). Change-Id: If8a7cf9bc876f84864d66f5aed5f2f61c5d0696a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
-rw-r--r--openstackclient/shell.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index bc88e1f1..1be298be 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -17,6 +17,7 @@
"""Command-line interface to the OpenStack APIs"""
import sys
+import warnings
from osc_lib.api import auth
from osc_lib.command import commandmanager
@@ -44,6 +45,10 @@ class OpenStackShell(shell.OpenStackShell):
# Assume TLS host certificate verification is enabled
self.verify = True
+ # ignore warnings from openstacksdk since our users can't do anything
+ # about them
+ warnings.filterwarnings('ignore', module='openstack')
+
def build_option_parser(self, description, version):
parser = super(OpenStackShell, self).build_option_parser(
description,