Add version pin for image list function
image functions deprecated after v2.35 but we didn't pin the version for them, so when use 2.37 by default won't work. https://review.openstack.org/#/c/392523/ fixed others but unfortunately list function is missing test_readonly_nova.py was removed as it's only for 2.35 check while through this patch, >2.35 can be used Change-Id: Ia1157dcb68971c5f64f7ab068fc647f25cd265e4 Related-Bug: 1638506 Closes-Bug: 1650617
This commit is contained in:
parent
77048cc27e
commit
ca2fc77b43
|
@ -1,38 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from novaclient import api_versions
|
||||
from novaclient.tests.functional.v2.legacy import test_readonly_nova
|
||||
|
||||
|
||||
class SimpleReadOnlyNovaClientTest(
|
||||
test_readonly_nova.SimpleReadOnlyNovaClientTest):
|
||||
|
||||
"""Read only functional python-novaclient tests.
|
||||
|
||||
This only exercises client commands that are read only.
|
||||
"""
|
||||
|
||||
COMPUTE_API_VERSION = "2.latest"
|
||||
|
||||
def test_admin_image_list(self):
|
||||
# The nova images proxy API returns a 404 after 2.35.
|
||||
if self.client.api_version > api_versions.APIVersion('2.35'):
|
||||
ex = self.assertRaises(exceptions.CommandFailed,
|
||||
super(SimpleReadOnlyNovaClientTest, self).
|
||||
test_admin_image_list)
|
||||
self.assertIn('NotFound', six.text_type(ex))
|
||||
else:
|
||||
super(SimpleReadOnlyNovaClientTest, self).test_admin_image_list()
|
|
@ -76,12 +76,6 @@ msg_deprecate_img = ('WARNING: Command %s is deprecated and will be removed '
|
|||
'or openstackclient instead')
|
||||
|
||||
|
||||
# NOTE(mriedem): Remove this along with the deprecated commands in the first
|
||||
# python-novaclient release AFTER the nova server 15.0.0 'O' release.
|
||||
def emit_image_deprecation_warning(command_name):
|
||||
print(msg_deprecate_img % command_name, file=sys.stderr)
|
||||
|
||||
|
||||
def deprecated_proxy(fn, msg_format):
|
||||
@functools.wraps(fn)
|
||||
def wrapped(cs, *args, **kwargs):
|
||||
|
@ -1360,9 +1354,9 @@ def do_network_create(cs, args):
|
|||
dest="limit",
|
||||
metavar="<limit>",
|
||||
help=_('Number of images to return per request.'))
|
||||
@deprecated_image
|
||||
def do_image_list(cs, _args):
|
||||
"""DEPRECATED: Print a list of available images to boot from."""
|
||||
emit_image_deprecation_warning('image-list')
|
||||
"""Print a list of available images to boot from."""
|
||||
limit = _args.limit
|
||||
image_list = cs.images.list(limit=limit)
|
||||
|
||||
|
|
Loading…
Reference in New Issue