From e5f1f7f8e7f24de8ddecbedc01642c993488d404 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 12 May 2017 14:16:59 -0400 Subject: [PATCH] Fix warning for deprecated cert commands If3e1e40947a8ad3f665f6a96d46de8cef6a2a190 deprecated the cert CLIs but used the wrong warning mechanism. For the python API bindings we use the warnings module, but for the CLI we print to stderr. Change-Id: I4dfd9e9dddbc0c7eb8c7115d2241955a630749e6 --- novaclient/v2/shell.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 2c3fd34f8..7a93d3b70 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -27,7 +27,6 @@ import os import pprint import sys import time -import warnings from oslo_utils import netutils from oslo_utils import strutils @@ -2963,7 +2962,7 @@ def do_usage(cs, args): help=_('Filename for the X.509 certificate. [Default: cert.pem]')) def do_x509_create_cert(cs, args): """DEPRECATED Create x509 cert for a user in tenant.""" - warnings.warn(CERT_DEPRECATION_WARNING, DeprecationWarning) + print(CERT_DEPRECATION_WARNING, file=sys.stderr) if os.path.exists(args.pk_filename): raise exceptions.CommandError(_("Unable to write privatekey - %s " @@ -2995,7 +2994,7 @@ def do_x509_create_cert(cs, args): help=_('Filename to write the x509 root cert.')) def do_x509_get_root_cert(cs, args): """DEPRECATED Fetch the x509 root cert.""" - warnings.warn(CERT_DEPRECATION_WARNING, DeprecationWarning) + print(CERT_DEPRECATION_WARNING, file=sys.stderr) if os.path.exists(args.filename): raise exceptions.CommandError(_("Unable to write x509 root cert - \ %s exists.") % args.filename)