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
This commit is contained in:
Matt Riedemann
2017-05-12 14:16:59 -04:00
parent 3e9a98b838
commit e5f1f7f8e7

View File

@@ -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)