From 29c84cdf8b1f5982bdb90149ff66476d67e3a4ae Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Wed, 18 Mar 2015 14:57:50 -0500 Subject: [PATCH] Deprecate keystone CLI The keystone CLI is now deprecated. Every time you run it it's going to print out an annoying message saying how deprecated it is. bp deprecate-cli Change-Id: Ife7ad2025f515dc716efe2b2dd275663c21402da --- keystoneclient/shell.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/keystoneclient/shell.py b/keystoneclient/shell.py index 854cafe09..1221e57a0 100644 --- a/keystoneclient/shell.py +++ b/keystoneclient/shell.py @@ -14,13 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" -Pending deprecation: Command-line interface to the OpenStack Identity API. - -This CLI is pending deprecation in favor of python-openstackclient. For a -Python library, continue using python-keystoneclient. - -""" +"""Command-line interface to the OpenStack Identity API.""" from __future__ import print_function @@ -29,6 +23,7 @@ import getpass import logging import os import sys +import warnings from oslo_utils import encodeutils import six @@ -60,6 +55,16 @@ def env(*vars, **kwargs): class OpenStackIdentityShell(object): def __init__(self, parser_class=argparse.ArgumentParser): + + # Since Python 2.7, DeprecationWarning is ignored by default, enable + # it so that the deprecation message is displayed. + warnings.simplefilter('once', category=DeprecationWarning) + warnings.warn( + 'The keystone CLI is deprecated in favor of ' + 'python-openstackclient. For a Python library, continue using ' + 'python-keystoneclient.', DeprecationWarning) + # And back to normal! + warnings.resetwarnings() self.parser_class = parser_class def get_base_parser(self):