From 8c73ba44714163fa99ce10ce46ff39deaeb9b9cf Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 11 Jan 2018 16:31:45 -0500 Subject: [PATCH] Remove deprecated cloudpipe CLIs and python API bindings These were all deprecated in the 9.0.0 release in Pike via change I329ee0e5fcf068ea7e54b99fbaf94a524647f660 and we can remove them now. This will go into 10.0.0. Change-Id: Ia90a49112847e365fcdaf581dc9ee32f9a20fd85 --- .../tests/unit/fixture_data/cloudpipe.py | 37 -------- novaclient/tests/unit/v2/fakes.py | 21 ----- novaclient/tests/unit/v2/test_cloudpipe.py | 57 ------------ novaclient/tests/unit/v2/test_shell.py | 15 ---- novaclient/v2/client.py | 2 - novaclient/v2/cloudpipe.py | 88 ------------------- novaclient/v2/shell.py | 38 -------- .../remove-cloudpipe-6c790c57dc3796eb.yaml | 6 ++ 8 files changed, 6 insertions(+), 258 deletions(-) delete mode 100644 novaclient/tests/unit/fixture_data/cloudpipe.py delete mode 100644 novaclient/tests/unit/v2/test_cloudpipe.py delete mode 100644 novaclient/v2/cloudpipe.py create mode 100644 releasenotes/notes/remove-cloudpipe-6c790c57dc3796eb.yaml diff --git a/novaclient/tests/unit/fixture_data/cloudpipe.py b/novaclient/tests/unit/fixture_data/cloudpipe.py deleted file mode 100644 index b19e24342..000000000 --- a/novaclient/tests/unit/fixture_data/cloudpipe.py +++ /dev/null @@ -1,37 +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. - -from novaclient.tests.unit.fixture_data import base - - -class Fixture(base.Fixture): - - base_url = 'os-cloudpipe' - - def setUp(self): - super(Fixture, self).setUp() - - get_os_cloudpipe = {'cloudpipes': [{'project_id': 1}]} - self.requests_mock.get(self.url(), - json=get_os_cloudpipe, - headers=self.json_headers) - - instance_id = '9d5824aa-20e6-4b9f-b967-76a699fc51fd' - post_os_cloudpipe = {'instance_id': instance_id} - self.requests_mock.post(self.url(), - json=post_os_cloudpipe, - headers=self.json_headers, - status_code=202) - - self.requests_mock.put(self.url('configure-project'), - headers=self.json_headers, - status_code=202) diff --git a/novaclient/tests/unit/v2/fakes.py b/novaclient/tests/unit/v2/fakes.py index bdb8d6735..81947be31 100644 --- a/novaclient/tests/unit/v2/fakes.py +++ b/novaclient/tests/unit/v2/fakes.py @@ -815,27 +815,6 @@ class FakeSessionClient(base_client.SessionClient): def post_servers_5678_action(self, body, **kw): return self.post_servers_1234_action(body, **kw) - # - # Cloudpipe - # - - def get_os_cloudpipe(self, **kw): - return ( - 200, - {}, - {'cloudpipes': [{'project_id': 1}]} - ) - - def post_os_cloudpipe(self, **ks): - return ( - 202, - {}, - {'instance_id': '9d5824aa-20e6-4b9f-b967-76a699fc51fd'} - ) - - def put_os_cloudpipe_configure_project(self, **kw): - return (202, {}, None) - # # Flavors # diff --git a/novaclient/tests/unit/v2/test_cloudpipe.py b/novaclient/tests/unit/v2/test_cloudpipe.py deleted file mode 100644 index 2e48d848e..000000000 --- a/novaclient/tests/unit/v2/test_cloudpipe.py +++ /dev/null @@ -1,57 +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 mock -import six - -from novaclient.tests.unit.fixture_data import client -from novaclient.tests.unit.fixture_data import cloudpipe as data -from novaclient.tests.unit import utils -from novaclient.tests.unit.v2 import fakes -from novaclient.v2 import cloudpipe - - -class CloudpipeTest(utils.FixturedTestCase): - - data_fixture_class = data.Fixture - - scenarios = [('original', {'client_fixture_class': client.V1}), - ('session', {'client_fixture_class': client.SessionV1})] - - @mock.patch('warnings.warn') - def test_list_cloudpipes(self, mock_warn): - cp = self.cs.cloudpipe.list() - self.assert_request_id(cp, fakes.FAKE_REQUEST_ID_LIST) - self.assert_called('GET', '/os-cloudpipe') - for c in cp: - self.assertIsInstance(c, cloudpipe.Cloudpipe) - mock_warn.assert_called_once_with(mock.ANY) - - @mock.patch('warnings.warn') - def test_create(self, mock_warn): - project = "test" - cp = self.cs.cloudpipe.create(project) - self.assert_request_id(cp, fakes.FAKE_REQUEST_ID_LIST) - body = {'cloudpipe': {'project_id': project}} - self.assert_called('POST', '/os-cloudpipe', body) - self.assertIsInstance(cp, six.string_types) - mock_warn.assert_called_once_with(mock.ANY) - - @mock.patch('warnings.warn') - def test_update(self, mock_warn): - cp = self.cs.cloudpipe.update("192.168.1.1", 2345) - self.assert_request_id(cp, fakes.FAKE_REQUEST_ID_LIST) - body = {'configure_project': {'vpn_ip': "192.168.1.1", - 'vpn_port': 2345}} - self.assert_called('PUT', '/os-cloudpipe/configure-project', body) - mock_warn.assert_called_once_with(mock.ANY) diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index 30b695e88..f1e5a9cd2 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -2768,21 +2768,6 @@ class ShellTest(utils.TestCase): 'PUT', '/os-quota-class-sets/97f4c221bff44578b0300df4ef119353', body) - def test_cloudpipe_list(self): - self.run_command('cloudpipe-list') - self.assert_called('GET', '/os-cloudpipe') - - def test_cloudpipe_create(self): - self.run_command('cloudpipe-create myproject') - body = {'cloudpipe': {'project_id': "myproject"}} - self.assert_called('POST', '/os-cloudpipe', body) - - def test_cloudpipe_configure(self): - self.run_command('cloudpipe-configure 192.168.1.1 1234') - body = {'configure_project': {'vpn_ip': "192.168.1.1", - 'vpn_port': '1234'}} - self.assert_called('PUT', '/os-cloudpipe/configure-project', body) - def test_add_fixed_ip(self): _, err = self.run_command('add-fixed-ip sample-server 1') self.assertIn('WARNING: Command add-fixed-ip is deprecated', err) diff --git a/novaclient/v2/client.py b/novaclient/v2/client.py index 54f8bd056..5a94275e6 100644 --- a/novaclient/v2/client.py +++ b/novaclient/v2/client.py @@ -23,7 +23,6 @@ from novaclient.v2 import aggregates from novaclient.v2 import assisted_volume_snapshots from novaclient.v2 import availability_zones from novaclient.v2 import cells -from novaclient.v2 import cloudpipe from novaclient.v2 import contrib from novaclient.v2 import flavor_access from novaclient.v2 import flavors @@ -148,7 +147,6 @@ class Client(object): # extensions self.agents = agents.AgentsManager(self) - self.cloudpipe = cloudpipe.CloudpipeManager(self) self.volumes = volumes.VolumeManager(self) self.keypairs = keypairs.KeypairManager(self) self.neutron = networks.NeutronManager(self) diff --git a/novaclient/v2/cloudpipe.py b/novaclient/v2/cloudpipe.py deleted file mode 100644 index b9ac9f65a..000000000 --- a/novaclient/v2/cloudpipe.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2012 OpenStack Foundation -# All Rights Reserved. -# -# 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. - -"""DEPRECATED Cloudpipe interface.""" - -import warnings - -from novaclient import base -from novaclient.i18n import _ - - -DEPRECATION_WARNING = ( - _('The os-cloudpipe Nova API has been removed. This API binding will be ' - 'removed in the first major release after the Nova server 16.0.0 Pike ' - 'release.') -) - - -class Cloudpipe(base.Resource): - """A cloudpipe instance is a VPN attached to a project's VLAN.""" - - def __repr__(self): - return "" % self.project_id - - def delete(self): - """ - DEPRECATED Delete the own cloudpipe instance - - :returns: An instance of novaclient.base.TupleWithMeta - """ - - warnings.warn(DEPRECATION_WARNING) - - return self.manager.delete(self) - - -class CloudpipeManager(base.ManagerWithFind): - """DEPRECATED""" - - resource_class = Cloudpipe - - def create(self, project): - """DEPRECATED Launch a cloudpipe instance. - - :param project: UUID of the project (tenant) for the cloudpipe - """ - - warnings.warn(DEPRECATION_WARNING) - - body = {'cloudpipe': {'project_id': project}} - return self._create('/os-cloudpipe', body, 'instance_id', - return_raw=True) - - def list(self): - """DEPRECATED Get a list of cloudpipe instances.""" - - warnings.warn(DEPRECATION_WARNING) - - return self._list('/os-cloudpipe', 'cloudpipes') - - def update(self, address, port): - """DEPRECATED Configure cloudpipe parameters for the project. - - Update VPN address and port for all networks associated - with the project defined by authentication - - :param address: IP address - :param port: Port number - :returns: An instance of novaclient.base.TupleWithMeta - """ - - warnings.warn(DEPRECATION_WARNING) - - body = {'configure_project': {'vpn_ip': address, - 'vpn_port': port}} - return self._update("/os-cloudpipe/configure-project", body) diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 2d50d1164..d1f1bfadc 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -48,12 +48,6 @@ from novaclient.v2 import servers logger = logging.getLogger(__name__) -CLOUDPIPE_DEPRECATION_WARNING = ( - _('The os-cloudpipe Nova API has been removed. This command will be ' - 'removed in the first major release after the Nova server 16.0.0 Pike ' - 'release.') -) - # NOTE(mriedem): Remove this along with the deprecated commands in the first # major python-novaclient release AFTER the nova server 16.0.0 Pike release. @@ -923,38 +917,6 @@ def do_boot(cs, args): _poll_for_status(cs.servers.get, server.id, 'building', ['active']) -def do_cloudpipe_list(cs, _args): - """DEPRECATED Print a list of all cloudpipe instances.""" - - print(CLOUDPIPE_DEPRECATION_WARNING, file=sys.stderr) - - cloudpipes = cs.cloudpipe.list() - columns = ['Project Id', "Public IP", "Public Port", "Internal IP"] - utils.print_list(cloudpipes, columns) - - -@utils.arg( - 'project', - metavar='', - help=_('UUID of the project to create the cloudpipe for.')) -def do_cloudpipe_create(cs, args): - """DEPRECATED Create a cloudpipe instance for the given project.""" - - print(CLOUDPIPE_DEPRECATION_WARNING, file=sys.stderr) - - cs.cloudpipe.create(args.project) - - -@utils.arg('address', metavar='', help=_('New IP Address.')) -@utils.arg('port', metavar='', help=_('New Port.')) -def do_cloudpipe_configure(cs, args): - """DEPRECATED Update the VPN IP/port of a cloudpipe instance.""" - - print(CLOUDPIPE_DEPRECATION_WARNING, file=sys.stderr) - - cs.cloudpipe.update(args.address, args.port) - - def _poll_for_status(poll_fn, obj_id, action, final_ok_states, poll_period=5, show_progress=True, status_field="status", silent=False): diff --git a/releasenotes/notes/remove-cloudpipe-6c790c57dc3796eb.yaml b/releasenotes/notes/remove-cloudpipe-6c790c57dc3796eb.yaml new file mode 100644 index 000000000..4ee7e8136 --- /dev/null +++ b/releasenotes/notes/remove-cloudpipe-6c790c57dc3796eb.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The deprecated ``nova cloudpipe-list``, ``nova cloudpipe-create``, and + ``nova cloudpipe-configure`` commands and the ``novaclient.v2.cloudpipe`` + API bindings have been removed.