Mark cloudpipe deprecated in novaclient
Functional tests have been failing since a chance went into nova that removed the cloudpipe functionality. This change removes the sole functional test that depended on that API, and ensures that all the cloudpipe interfaces are marked deprecated and emit proper warnings. Change-Id: I329ee0e5fcf068ea7e54b99fbaf94a524647f660
This commit is contained in:
parent
3e9a98b838
commit
0d92534824
@ -38,9 +38,6 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
|
||||
def test_admin_availability_zone_list(self):
|
||||
self.assertIn("internal", self.nova('availability-zone-list'))
|
||||
|
||||
def test_admin_cloudpipe_list(self):
|
||||
self.nova('cloudpipe-list')
|
||||
|
||||
def test_admin_flavor_acces_list(self):
|
||||
self.assertRaises(exceptions.CommandFailed,
|
||||
self.nova,
|
||||
|
@ -11,6 +11,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from novaclient.tests.unit.fixture_data import client
|
||||
@ -27,24 +28,30 @@ class CloudpipeTest(utils.FixturedTestCase):
|
||||
scenarios = [('original', {'client_fixture_class': client.V1}),
|
||||
('session', {'client_fixture_class': client.SessionV1})]
|
||||
|
||||
def test_list_cloudpipes(self):
|
||||
@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)
|
||||
|
||||
def test_create(self):
|
||||
@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)
|
||||
|
||||
def test_update(self):
|
||||
@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)
|
||||
|
@ -13,9 +13,19 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Cloudpipe interface."""
|
||||
"""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):
|
||||
@ -26,31 +36,42 @@ class Cloudpipe(base.Resource):
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Delete the own cloudpipe instance
|
||||
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):
|
||||
"""Launch a cloudpipe instance.
|
||||
"""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):
|
||||
"""Get a list of cloudpipe instances."""
|
||||
"""DEPRECATED Get a list of cloudpipe instances."""
|
||||
|
||||
warnings.warn(DEPRECATION_WARNING)
|
||||
|
||||
return self._list('/os-cloudpipe', 'cloudpipes')
|
||||
|
||||
def update(self, address, port):
|
||||
"""Configure cloudpipe parameters for the project.
|
||||
"""DEPRECATED Configure cloudpipe parameters for the project.
|
||||
|
||||
Update VPN address and port for all networks associated
|
||||
with the project defined by authentication
|
||||
@ -60,6 +81,8 @@ class CloudpipeManager(base.ManagerWithFind):
|
||||
: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)
|
||||
|
@ -54,6 +54,12 @@ CERT_DEPRECATION_WARNING = (
|
||||
'in the first major release after the Nova server 16.0.0 Pike release.')
|
||||
)
|
||||
|
||||
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.
|
||||
@ -856,7 +862,10 @@ def do_boot(cs, args):
|
||||
|
||||
|
||||
def do_cloudpipe_list(cs, _args):
|
||||
"""Print a list of all cloudpipe instances."""
|
||||
"""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)
|
||||
@ -867,14 +876,20 @@ def do_cloudpipe_list(cs, _args):
|
||||
metavar='<project_id>',
|
||||
help=_('UUID of the project to create the cloudpipe for.'))
|
||||
def do_cloudpipe_create(cs, args):
|
||||
"""Create a cloudpipe instance for the given project."""
|
||||
"""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='<ip address>', help=_('New IP Address.'))
|
||||
@utils.arg('port', metavar='<port>', help=_('New Port.'))
|
||||
def do_cloudpipe_configure(cs, args):
|
||||
"""Update the VPN IP/port of a cloudpipe instance."""
|
||||
"""DEPRECATED Update the VPN IP/port of a cloudpipe instance."""
|
||||
|
||||
print(CLOUDPIPE_DEPRECATION_WARNING, file=sys.stderr)
|
||||
|
||||
cs.cloudpipe.update(args.address, args.port)
|
||||
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The os-cloudpipe API has been removed from Nova. As a result, the
|
||||
``nova cloudpipe-list``, ``nova cloudpipe-create``, and ``nova
|
||||
cloudpipe-configure`` commands and the ``novaclient.v2.cloudpipe``
|
||||
API bindings are now deprecated, and will be removed in the first
|
||||
major release after the Nova server 16.0.0 Pike release.
|
Loading…
x
Reference in New Issue
Block a user