diff --git a/doc/source/conf.py b/doc/source/conf.py index b98da5d9b..ffd5782d6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,8 +26,7 @@ extensions = [ apidoc_module_dir = '../../novaclient' apidoc_output_dir = 'reference/api' apidoc_excluded_paths = [ - 'tests/*', - 'v2/contrib/*'] + 'tests/*'] apidoc_separate_modules = True # The content that will be inserted into the main body of an autoclass diff --git a/novaclient/client.py b/novaclient/client.py index 76a2007be..2808428ed 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -40,11 +40,6 @@ from novaclient import utils osprofiler_profiler = importutils.try_import("osprofiler.profiler") osprofiler_web = importutils.try_import("osprofiler.web") -# TODO(jichenjc): when an extension in contrib is moved to core extension, -# Add the name into the following list, then after last patch merged, -# remove the whole function -extensions_ignored_name = ["__init__"] - class SessionClient(adapter.LegacyJsonAdapter): @@ -178,14 +173,6 @@ def discover_extensions(*args, **kwargs): """Returns the list of extensions, which can be discovered by python path and by entry-point 'novaclient.extension'. """ - # TODO(mriedem): Remove support for 'only_contrib' in Queens. - if 'only_contrib' in kwargs and kwargs['only_contrib']: - warnings.warn(_('Discovering extensions only by contrib path is no ' - 'longer supported since all contrib extensions ' - 'have either been made required or removed. The ' - 'only_contrib argument is deprecated and will be ' - 'removed in a future release.')) - return [] chain = itertools.chain(_discover_via_python_path(), _discover_via_entry_points()) return [ext.Extension(name, module) for name, module in chain] diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py index 97cfbf31f..3411eb505 100644 --- a/novaclient/tests/unit/test_client.py +++ b/novaclient/tests/unit/test_client.py @@ -109,23 +109,6 @@ class ClientsUtilsTest(utils.TestCase): mock_discover_via_entry_points.assert_called_once_with() self.assertEqual([mock_extension()] * 4, result) - @mock.patch('novaclient.client.warnings') - @mock.patch("novaclient.client._discover_via_entry_points") - @mock.patch("novaclient.client._discover_via_python_path") - @mock.patch("novaclient.extension.Extension") - def test_discover_extensions_only_contrib( - self, mock_extension, mock_discover_via_python_path, - mock_discover_via_entry_points, mock_warnings): - - version = novaclient.api_versions.APIVersion("2.0") - - self.assertEqual([], novaclient.client.discover_extensions( - version, only_contrib=True)) - self.assertFalse(mock_discover_via_python_path.called) - self.assertFalse(mock_discover_via_entry_points.called) - self.assertFalse(mock_extension.called) - self.assertTrue(mock_warnings.warn.called) - @mock.patch("novaclient.client.warnings") def test__check_arguments(self, mock_warnings): release = "Coolest" diff --git a/novaclient/v2/client.py b/novaclient/v2/client.py index ee4fc3453..54abcf27d 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 contrib from novaclient.v2 import flavor_access from novaclient.v2 import flavors from novaclient.v2 import hypervisors @@ -182,15 +181,6 @@ class Client(object): # Add in any extensions... if extensions: for extension in extensions: - # do not import extensions from contrib directory twice. - if extension.name in contrib.V2_0_EXTENSIONS: - # NOTE(andreykurilin): this message looks more like - # warning or note, but it is not critical, so let's do - # not flood "warning" logging level and use just debug.. - self.logger.debug("Nova 2.0 extenstion '%s' is auto-loaded" - " by default. You do not need to specify" - " it manually.", extension.name) - continue if extension.manager_class: setattr(self, extension.name, extension.manager_class(self)) diff --git a/novaclient/v2/contrib/__init__.py b/novaclient/v2/contrib/__init__.py deleted file mode 100644 index 3cbadc17b..000000000 --- a/novaclient/v2/contrib/__init__.py +++ /dev/null @@ -1,51 +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 inspect -import warnings - -from novaclient.i18n import _ - -# NOTE(andreykurilin): "tenant_networks" extension excluded -# here deliberately. It was deprecated separately from deprecation -# extension mechanism and I prefer to not auto-load it by default -# (V2_0_EXTENSIONS is designed for such behaviour). -V2_0_EXTENSIONS = { - 'assisted_volume_snapshots': - 'novaclient.v2.assisted_volume_snapshots', - 'cells': 'novaclient.v2.cells', - 'instance_action': 'novaclient.v2.instance_action', - 'list_extensions': 'novaclient.v2.list_extensions', - 'migrations': 'novaclient.v2.migrations', - 'server_external_events': 'novaclient.v2.server_external_events', -} - - -def warn(alternative=True): - """Prints warning msg for contrib modules.""" - frm = inspect.stack()[1] - module_name = inspect.getmodule(frm[0]).__name__ - if module_name.startswith("novaclient.v2.contrib."): - if alternative: - new_module_name = module_name.replace("contrib.", "") - msg = _("Module `%(module)s` is deprecated as of OpenStack " - "Ocata in favor of `%(new_module)s` and will be " - "removed after OpenStack Pike.") % { - "module": module_name, "new_module": new_module_name} - - if not alternative: - msg = _("Module `%s` is deprecated as of OpenStack Ocata " - "All shell commands were moved to " - "`novaclient.v2.shell` and will be automatically " - "loaded.") % module_name - - warnings.warn(msg) diff --git a/novaclient/v2/contrib/assisted_volume_snapshots.py b/novaclient/v2/contrib/assisted_volume_snapshots.py deleted file mode 100644 index 95b5073a2..000000000 --- a/novaclient/v2/contrib/assisted_volume_snapshots.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2013, Red Hat, Inc. -# -# 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. - -""" -Assisted volume snapshots - to be used by Cinder and not end users. -""" - -from novaclient.v2 import assisted_volume_snapshots -from novaclient.v2 import contrib - - -AssistedSnapshotManager = assisted_volume_snapshots.AssistedSnapshotManager -Snapshot = assisted_volume_snapshots.Snapshot - -manager_class = AssistedSnapshotManager -name = 'assisted_volume_snapshots' - -contrib.warn() diff --git a/novaclient/v2/contrib/cells.py b/novaclient/v2/contrib/cells.py deleted file mode 100644 index a689d00a9..000000000 --- a/novaclient/v2/contrib/cells.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -from novaclient.v2 import cells -from novaclient.v2 import contrib - - -Cell = cells.Cell -CellsManager = cells.CellsManager - -contrib.warn() diff --git a/novaclient/v2/contrib/deferred_delete.py b/novaclient/v2/contrib/deferred_delete.py deleted file mode 100644 index bd5798ac7..000000000 --- a/novaclient/v2/contrib/deferred_delete.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# -# 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.v2 import contrib - -contrib.warn(alternative=False) diff --git a/novaclient/v2/contrib/host_evacuate.py b/novaclient/v2/contrib/host_evacuate.py deleted file mode 100644 index b5305bcb7..000000000 --- a/novaclient/v2/contrib/host_evacuate.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -from novaclient.v2 import contrib -from novaclient.v2 import shell - - -EvacuateHostResponse = shell.EvacuateHostResponse - -contrib.warn(alternative=False) diff --git a/novaclient/v2/contrib/host_evacuate_live.py b/novaclient/v2/contrib/host_evacuate_live.py deleted file mode 100644 index 7e27d7359..000000000 --- a/novaclient/v2/contrib/host_evacuate_live.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2014 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. - -from novaclient.v2 import contrib - -contrib.warn(alternative=False) diff --git a/novaclient/v2/contrib/host_servers_migrate.py b/novaclient/v2/contrib/host_servers_migrate.py deleted file mode 100644 index e88da876b..000000000 --- a/novaclient/v2/contrib/host_servers_migrate.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -from novaclient.v2 import contrib -from novaclient.v2 import shell - - -HostServersMigrateResponse = shell.HostServersMigrateResponse - -contrib.warn(alternative=False) diff --git a/novaclient/v2/contrib/instance_action.py b/novaclient/v2/contrib/instance_action.py deleted file mode 100644 index a90b99bd5..000000000 --- a/novaclient/v2/contrib/instance_action.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -from novaclient.v2 import contrib -from novaclient.v2 import instance_action - - -InstanceActionManager = instance_action.InstanceActionManager - -contrib.warn() diff --git a/novaclient/v2/contrib/list_extensions.py b/novaclient/v2/contrib/list_extensions.py deleted file mode 100644 index 07f4e3d7f..000000000 --- a/novaclient/v2/contrib/list_extensions.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2011 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. - -from novaclient.v2 import contrib -from novaclient.v2 import list_extensions - - -ListExtResource = list_extensions.ListExtResource -ListExtManager = list_extensions.ListExtManager - -contrib.warn() diff --git a/novaclient/v2/contrib/metadata_extensions.py b/novaclient/v2/contrib/metadata_extensions.py deleted file mode 100644 index eb6fbd224..000000000 --- a/novaclient/v2/contrib/metadata_extensions.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -from novaclient.v2 import contrib - - -contrib.warn(alternative=False) diff --git a/novaclient/v2/contrib/migrations.py b/novaclient/v2/contrib/migrations.py deleted file mode 100644 index 909b569c6..000000000 --- a/novaclient/v2/contrib/migrations.py +++ /dev/null @@ -1,24 +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. - -""" -migration interface -""" - -from novaclient.v2 import contrib -from novaclient.v2 import migrations - - -Migration = migrations.Migration -MigrationManager = migrations.MigrationManager - -contrib.warn() diff --git a/novaclient/v2/contrib/server_external_events.py b/novaclient/v2/contrib/server_external_events.py deleted file mode 100644 index bbd1b032f..000000000 --- a/novaclient/v2/contrib/server_external_events.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2014, Red Hat, Inc. -# -# 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. - -""" -External event triggering for servers, not to be used by users. -""" - -from novaclient.v2 import contrib -from novaclient.v2 import server_external_events - - -Event = server_external_events.Event -ServerExternalEventManager = server_external_events.ServerExternalEventManager - -manager_class = ServerExternalEventManager -name = 'server_external_events' - -contrib.warn() diff --git a/releasenotes/notes/remove-contrib-8b5e35ac8dddbab3.yaml b/releasenotes/notes/remove-contrib-8b5e35ac8dddbab3.yaml new file mode 100644 index 000000000..413a283d2 --- /dev/null +++ b/releasenotes/notes/remove-contrib-8b5e35ac8dddbab3.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - All modules of ``novaclient.v2.contrib`` have been removed. + - The ``only_contrib`` parameter for the + ``novaclient.client.discover_extensions`` method is no longer valid.