From 226c6fb0a3acb96a893c14b597d2bab74e7b0bdb Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Tue, 28 Mar 2017 13:56:44 -0400 Subject: [PATCH] Remove deprecated manila-all command Change [1] deprecated this command in newton and promised to remove it in ocata. [1] I0ac0c699071324b218f63422354a871b7fa3b81e Depends-On: I3aa1d145d21d587355af538a3569adf0b4ca715f Change-Id: I589e6c0f2f44f3e5e54ee9d9368dfa2423dec1d3 --- manila/cmd/all.py | 82 ---------------------------------- manila/tests/cmd/test_all.py | 85 ------------------------------------ 2 files changed, 167 deletions(-) delete mode 100644 manila/cmd/all.py delete mode 100644 manila/tests/cmd/test_all.py diff --git a/manila/cmd/all.py b/manila/cmd/all.py deleted file mode 100644 index fcc759b7cf..0000000000 --- a/manila/cmd/all.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2011 OpenStack, LLC -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# 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. - -"""Starter script for All manila services. - -This script attempts to start all the manila services in one process. Each -service is started in its own greenthread. Please note that exceptions and -sys.exit() on the starting of a service are logged and the script will -continue attempting to launch the rest of the services. - -""" - -import eventlet -eventlet.monkey_patch() - -import sys - -from oslo_config import cfg -from oslo_log import log -from oslo_log import versionutils - -from manila import i18n -i18n.enable_lazy() - -from manila.common import config # Need to register global_opts -from manila.i18n import _ -from manila.i18n import _LE -from manila import service -from manila import utils -from manila import version - -CONF = cfg.CONF - - -def main(): - log.register_options(CONF) - config.set_middleware_defaults() - CONF(sys.argv[1:], project='manila', - version=version.version_string()) - log.setup(CONF, "manila") - LOG = log.getLogger('manila.all') - - msg = _('manila-all is deprecated in Newton and ' - 'will be removed in Ocata.') - versionutils.report_deprecated_feature(LOG, msg) - - utils.monkey_patch() - launcher = service.process_launcher() - # manila-api - try: - server = service.WSGIService('osapi_share') - launcher.launch_service(server, workers=server.workers or 1) - except (Exception, SystemExit): - LOG.exception(_LE('Failed to load osapi_share')) - - for binary in ['manila-share', 'manila-scheduler', 'manila-api', - 'manila-data']: - try: - launcher.launch_service(service.Service.create(binary=binary)) - except (Exception, SystemExit): - LOG.exception(_LE('Failed to load %s'), binary) - launcher.wait() - - -if __name__ == '__main__': - main() diff --git a/manila/tests/cmd/test_all.py b/manila/tests/cmd/test_all.py deleted file mode 100644 index 3196f6ad07..0000000000 --- a/manila/tests/cmd/test_all.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright 2015 Mirantis Inc. -# 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. - -import sys - -import ddt -import mock -from oslo_log import log -from oslo_log import versionutils - -from manila.cmd import all as manila_all -from manila import service -from manila import test -from manila import utils -from manila import version - -CONF = manila_all.CONF - - -@ddt.ddt -class ManilaCmdAllTestCase(test.TestCase): - def setUp(self): - super(ManilaCmdAllTestCase, self).setUp() - sys.argv = ['manila-all'] - - self.mock_object(log, 'setup') - self.mock_object(log, 'register_options') - self.mock_object(log, 'getLogger') - self.mock_object(utils, 'monkey_patch') - self.mock_object(service, 'process_launcher') - self.mock_object(service, 'WSGIService') - self.mock_object(service.Service, 'create') - self.mock_object(versionutils, 'report_deprecated_feature') - self.wsgi_service = service.WSGIService.return_value - self.service = service.Service.create.return_value - self.fake_log = log.getLogger.return_value - - def _common_checks(self): - self.assertEqual('manila', CONF.project) - self.assertEqual(version.version_string(), CONF.version) - log.setup.assert_called_once_with(CONF, "manila") - log.register_options.assert_called_once_with(CONF) - log.getLogger.assert_called_once_with('manila.all') - self.assertEqual(versionutils.report_deprecated_feature.call_count, 1) - utils.monkey_patch.assert_called_once_with() - service.process_launcher.assert_called_once_with() - service.WSGIService.assert_called_once_with('osapi_share') - - def test_main(self): - manila_all.main() - - self._common_checks() - self.assertFalse(self.fake_log.exception.called) - self.assertTrue( - service.process_launcher.return_value.launch_service.called) - self.assertTrue(service.process_launcher.return_value.wait.called) - - @ddt.data( - *[(exc, exc_in_wsgi) - for exc in (Exception(), SystemExit()) - for exc_in_wsgi in (True, False)] - ) - @ddt.unpack - def test_main_raise_exception(self, exc, exc_in_wsgi): - if exc_in_wsgi: - service.WSGIService.side_effect = exc - else: - service.Service.create.side_effect = exc - - manila_all.main() - - self._common_checks() - self.fake_log.exception.assert_has_calls([mock.ANY])