Mark bin/glance as deprecated
* Add a WARNING to the usage of bin/glance * Print a WARNING line to stderr when bin/glance is called * Raise a UserWarning on 'import glance.client' * Implements bp glance-deprecate-client Change-Id: Iabce7569d28c5dc73b5e1ceb55e4e4f2fc47727b
This commit is contained in:
parent
3d93ca6655
commit
c189324735
14
bin/glance
14
bin/glance
@ -28,7 +28,7 @@ import optparse
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
# If ../glance/__init__.py exists, add ../ to Python search path, so that
|
# If ../glance/__init__.py exists, add ../ to Python search path, so that
|
||||||
@ -41,7 +41,10 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
|||||||
|
|
||||||
gettext.install('glance', unicode=1)
|
gettext.install('glance', unicode=1)
|
||||||
|
|
||||||
from glance import client as glance_client
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
|
from glance import client as glance_client
|
||||||
|
|
||||||
from glance.common import exception
|
from glance.common import exception
|
||||||
from glance.common import utils
|
from glance.common import utils
|
||||||
from glance.version import version_info as version
|
from glance.version import version_info as version
|
||||||
@ -1022,6 +1025,9 @@ if __name__ == '__main__':
|
|||||||
usage = """
|
usage = """
|
||||||
%prog <command> [options] [args]
|
%prog <command> [options] [args]
|
||||||
|
|
||||||
|
WARNING! This tool is deprecated in favor of python-glanceclient (see
|
||||||
|
http://github.com/openstack/python-glanceclient).
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
|
||||||
help <command> Output help for one of the commands below
|
help <command> Output help for one of the commands below
|
||||||
@ -1056,6 +1062,10 @@ Member Commands:
|
|||||||
members-replace Replaces all membership for an image
|
members-replace Replaces all membership for an image
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print >> sys.stderr, ("WARNING! This tool is deprecated in favor of "
|
||||||
|
"python-glanceclient (see "
|
||||||
|
"http://github.com/openstack/python-glanceclient).")
|
||||||
|
|
||||||
oparser = optparse.OptionParser(version='%%prog %s'
|
oparser = optparse.OptionParser(version='%%prog %s'
|
||||||
% version.version_string(),
|
% version.version_string(),
|
||||||
usage=usage.strip())
|
usage=usage.strip())
|
||||||
|
@ -25,6 +25,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
import glance.api.v1
|
import glance.api.v1
|
||||||
from glance.common import animation
|
from glance.common import animation
|
||||||
@ -35,6 +36,11 @@ from glance.common import utils
|
|||||||
SUPPORTED_PARAMS = glance.api.v1.SUPPORTED_PARAMS
|
SUPPORTED_PARAMS = glance.api.v1.SUPPORTED_PARAMS
|
||||||
SUPPORTED_FILTERS = glance.api.v1.SUPPORTED_FILTERS
|
SUPPORTED_FILTERS = glance.api.v1.SUPPORTED_FILTERS
|
||||||
|
|
||||||
|
warn_msg = ("The 'glance.client' module is deprecated in favor of the "
|
||||||
|
"'glanceclient' module provided by python-glanceclient (see "
|
||||||
|
"http://github.com/openstack/python-glanceclient).")
|
||||||
|
warnings.warn(warn_msg, stacklevel=2)
|
||||||
|
|
||||||
|
|
||||||
class V1Client(base_client.BaseClient):
|
class V1Client(base_client.BaseClient):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user