Skip to content

Commit 23da7b7

Browse files
committed
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>
1 parent 864f51f commit 23da7b7

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
@@ -17,6 +17,7 @@
1717
"""Command-line interface to the OpenStack APIs"""
1818

1919
import sys
20+
import warnings
2021

2122
from osc_lib.api import auth
2223
from osc_lib.command import commandmanager
@@ -44,6 +45,10 @@ def __init__(self):
4445
# Assume TLS host certificate verification is enabled
4546
self.verify = True
4647

48+
# ignore warnings from openstacksdk since our users can't do anything
49+
# about them
50+
warnings.filterwarnings('ignore', module='openstack')
51+
4752
def build_option_parser(self, description, version):
4853
parser = super(OpenStackShell, self).build_option_parser(
4954
description,

0 commit comments

Comments
 (0)