From 90199d58869b9a2b8984be1fed15f1b6de3ea5c7 Mon Sep 17 00:00:00 2001 From: Joshua Kraitberg Date: Mon, 31 Mar 2025 08:46:58 -0400 Subject: [PATCH] Fixed missing HTTP debug logging on VIM requests When the sw-manager CLI ported some HTTP calls from urllib to requests the debug logging capability was lost. This change remedies this. TEST PLAN PASS: sw-manager ... commands work with no impact PASS: sw-manager --debug ... work with no impact * Requests to VIM should be seen: send: b'POST /api/orchestration/sw-upgrade/strategy ... * Other debug logging still present: send: b'POST /v3/auth/tokens ... Closes-Bug: https://bugs.launchpad.net/starlingx/+bug/2105490 Change-Id: I27d8509f618005a46d44ff0ace3ccd2bddfb475e Signed-off-by: Joshua Kraitberg --- nfv/nfv-client/nfv_client/shell.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nfv/nfv-client/nfv_client/shell.py b/nfv/nfv-client/nfv_client/shell.py index 85d7cbf9..75154728 100755 --- a/nfv/nfv-client/nfv_client/shell.py +++ b/nfv/nfv-client/nfv_client/shell.py @@ -1,9 +1,10 @@ # -# Copyright (c) 2016-2024 Wind River Systems, Inc. +# Copyright (c) 2016-2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import argparse +import http.client as http_client import os from six.moves import urllib import sys @@ -510,11 +511,14 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value args = parser.parse_args(argv) if args.debug: - # Enable Debug + # Enable debug for legacy HTTP requests handler = urllib.request.HTTPHandler(debuglevel=1) opener = urllib.request.build_opener(handler) urllib.request.install_opener(opener) + # Enable debug for requests library + http_client.HTTPConnection.debuglevel = 1 + if args.os_auth_url is None: args.os_auth_url = os.environ.get('OS_AUTH_URL', None)