From 23da7b73a285543745d4ea77aad4286ad59d474e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 20 Feb 2023 17:02:00 +0000 Subject: 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 --- openstackclient/shell.py | 5 +++++ 1 file changed, 5 insertions(+) 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, -- cgit v1.2.1