From 2843ce3c0a9d3e3ca7740c25d8d0bbd96134f26e Mon Sep 17 00:00:00 2001 From: Rob Cresswell Date: Thu, 3 Mar 2016 10:55:26 +0000 Subject: [PATCH] Enable Angular Launch Instance by default This patch enables the Angular Launch Instance workflow by default. The toggle has been maintained for those running the Python workflow, and also for the integration tests to run against both simultaneously. Keep integration tests running for a legacy Launch Instance workflow by means of a separate local_settings.d code snippet activated before starting the tests. Co-Authored-By: Timur Sufiev Change-Id: Id0c57b33df46397711e32092cec6cc5268841779 Implements: blueprint enable-angular-launch-instance --- .gitignore | 3 ++ doc/source/topics/settings.rst | 39 +++++++++++++++++++ .../project/images/images/tables.py | 4 +- .../dashboards/project/images/tests.py | 4 +- .../dashboards/project/instances/tables.py | 4 +- .../dashboards/project/instances/tests.py | 7 ++-- .../project/network_topology/tests.py | 1 + .../project/network_topology/views.py | 4 +- ..._20_integration_tests_scaffolds.py.example | 3 ++ .../pages/project/compute/imagespage.py | 2 +- ...ular-launch-instance-897f7bb227711c86.yaml | 7 ++++ tools/gate/integration/pre_test_hook.sh | 3 ++ 12 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 openstack_dashboard/local/local_settings.d/_20_integration_tests_scaffolds.py.example create mode 100644 releasenotes/notes/bp-enable-angular-launch-instance-897f7bb227711c86.yaml diff --git a/.gitignore b/.gitignore index 3ecac00c55..f464981a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ reports openstack_dashboard/local/* !openstack_dashboard/local/local_settings.py.example !openstack_dashboard/local/enabled/_50__settings.py.example +!openstack_dashboard/local/local_settings.d +openstack_dashboard/local/local_settings.d/* +!openstack_dashboard/local/local_settings.d/*.example openstack_dashboard/test/.secret_key_store openstack_dashboard/test/integration_tests/local-horizon.conf openstack_dashboard/wsgi/horizon.wsgi diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index 95774491c9..696d701a34 100644 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -630,6 +630,45 @@ properties found in the Launch Instance modal. The ``config_drive`` setting specifies the default value for the Configuration Drive property. + +``LAUNCH_INSTANCE_NG_ENABLED`` +------------------------------ + +.. versionadded:: 8.0.0(Liberty) + +Default: ``True`` + +This setting enables the AngularJS Launch Instance workflow. + +.. note:: + + The default value for this has been changed to ``True`` in 9.0.0 (Mitaka) + +.. note:: + + It is possible to run both the AngularJS and Python workflows simultaneously, + so the other may be need to be toggled with ``LAUNCH_INSTANCE_LEGACY_ENABLED`` + + +``LAUNCH_INSTANCE_LEGACY_ENABLED`` +---------------------------------- + +.. versionadded:: 8.0.0(Liberty) + +Default: ``False`` + +This setting enables the Python Launch Instance workflow. + +.. note:: + + The default value for this has been changed to ``False`` in 9.0.0 (Mitaka) + +.. note:: + + It is possible to run both the AngularJS and Python workflows simultaneously, + so the other may be need to be toggled with ``LAUNCH_INSTANCE_NG_ENABLED`` + + ``MESSAGES_PATH`` ----------------- diff --git a/openstack_dashboard/dashboards/project/images/images/tables.py b/openstack_dashboard/dashboards/project/images/images/tables.py index 27e0c509eb..94937481f6 100644 --- a/openstack_dashboard/dashboards/project/images/images/tables.py +++ b/openstack_dashboard/dashboards/project/images/images/tables.py @@ -331,9 +331,9 @@ class ImagesTable(tables.DataTable): verbose_name = _("Images") table_actions = (OwnerFilter, CreateImage, DeleteImage,) launch_actions = () - if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True): + if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False): launch_actions = (LaunchImage,) + launch_actions - if getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', False): + if getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', True): launch_actions = (LaunchImageNG,) + launch_actions row_actions = launch_actions + (CreateVolumeFromImage, EditImage, UpdateMetadata, diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index e114ed099a..9b62b68111 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -115,7 +115,7 @@ class ImagesAndSnapshotsTests(test.TestCase): # first instance - status active, owned self.assertEqual(len(row_actions), 5) - self.assertEqual(row_actions[0].verbose_name, u"Launch Instance") + self.assertEqual(row_actions[0].verbose_name, u"Launch") self.assertEqual(row_actions[1].verbose_name, u"Create Volume") self.assertEqual(row_actions[2].verbose_name, u"Edit Image") self.assertEqual(row_actions[3].verbose_name, u"Update Metadata") @@ -125,7 +125,7 @@ class ImagesAndSnapshotsTests(test.TestCase): # second instance - status active, not owned self.assertEqual(len(row_actions), 2) - self.assertEqual(row_actions[0].verbose_name, u"Launch Instance") + self.assertEqual(row_actions[0].verbose_name, u"Launch") self.assertEqual(row_actions[1].verbose_name, u"Create Volume") row_actions = snaps.get_row_actions(snaps.data[2]) diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index ced492ebe6..df3d0f3dfa 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -1199,9 +1199,9 @@ class InstancesTable(tables.DataTable): row_class = UpdateRow table_actions_menu = (StartInstance, StopInstance, SoftRebootInstance) launch_actions = () - if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True): + if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False): launch_actions = (LaunchLink,) + launch_actions - if getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', False): + if getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', True): launch_actions = (LaunchLinkNG,) + launch_actions table_actions = launch_actions + (DeleteInstance, InstancesFilterAction) diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 7eeb2cddd4..11210d6e53 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -3830,12 +3830,11 @@ class InstanceTests(helpers.TestCase): res = self.client.get(INDEX_URL) launch_action = self.getAndAssertTableAction(res, 'instances', - 'launch') + 'launch-ng') - self.assertEqual(set(['ajax-modal', 'ajax-update', 'btn-launch']), + self.assertEqual(set(['btn-launch']), set(launch_action.classes)) self.assertEqual('Launch Instance', launch_action.verbose_name) - self.assertEqual('horizon:project:instances:launch', launch_action.url) self.assertEqual((('compute', 'compute:create'),), launch_action.policy_rules) @@ -3878,7 +3877,7 @@ class InstanceTests(helpers.TestCase): res = self.client.get(INDEX_URL) launch_action = self.getAndAssertTableAction( - res, 'instances', 'launch') + res, 'instances', 'launch-ng') self.assertTrue('disabled' in launch_action.classes, 'The launch button should be disabled') diff --git a/openstack_dashboard/dashboards/project/network_topology/tests.py b/openstack_dashboard/dashboards/project/network_topology/tests.py index 8be4a7e8d1..65cbcd6b85 100644 --- a/openstack_dashboard/dashboards/project/network_topology/tests.py +++ b/openstack_dashboard/dashboards/project/network_topology/tests.py @@ -210,6 +210,7 @@ class NetworkTopologyCreateTests(test.TestCase): self._test_new_button_disabled_when_quota_exceeded( expected_string, routers_quota=0) + @test.update_settings(LAUNCH_INSTANCE_LEGACY_ENABLED=True) @test.create_stubs({quotas: ('tenant_quota_usages',)}) def test_launch_instance_button_disabled_when_quota_exceeded(self): url = reverse('horizon:project:network_topology:launchinstance') diff --git a/openstack_dashboard/dashboards/project/network_topology/views.py b/openstack_dashboard/dashboards/project/network_topology/views.py index 4f5c4661b5..683576ec71 100644 --- a/openstack_dashboard/dashboards/project/network_topology/views.py +++ b/openstack_dashboard/dashboards/project/network_topology/views.py @@ -212,9 +212,9 @@ class NetworkTopologyView(views.HorizonTemplateView): context['console_type'] = getattr( settings, 'CONSOLE_TYPE', 'AUTO') context['show_ng_launch'] = getattr( - settings, 'LAUNCH_INSTANCE_NG_ENABLED', False) + settings, 'LAUNCH_INSTANCE_NG_ENABLED', True) context['show_legacy_launch'] = getattr( - settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True) + settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False) return context diff --git a/openstack_dashboard/local/local_settings.d/_20_integration_tests_scaffolds.py.example b/openstack_dashboard/local/local_settings.d/_20_integration_tests_scaffolds.py.example new file mode 100644 index 0000000000..83e08c57bd --- /dev/null +++ b/openstack_dashboard/local/local_settings.d/_20_integration_tests_scaffolds.py.example @@ -0,0 +1,3 @@ +# Enable both Launch Instance wizards for the sake of testing +LAUNCH_INSTANCE_LEGACY_ENABLED = True +LAUNCH_INSTANCE_NG_ENABLED = True diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py index e7a4009629..df8b60f363 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py @@ -64,7 +64,7 @@ class ImagesTable(tables.TableRegion): self.driver, self.conf, field_mappings=self.CREATE_VOLUME_FROM_IMAGE_FORM_FIELDS) - @tables.bind_row_action('launch_image', primary=True) + @tables.bind_row_action('launch_image') def launch_instance(self, launch_instance, row): launch_instance.click() return forms.TabbedFormRegion( diff --git a/releasenotes/notes/bp-enable-angular-launch-instance-897f7bb227711c86.yaml b/releasenotes/notes/bp-enable-angular-launch-instance-897f7bb227711c86.yaml new file mode 100644 index 0000000000..2f0b75370b --- /dev/null +++ b/releasenotes/notes/bp-enable-angular-launch-instance-897f7bb227711c86.yaml @@ -0,0 +1,7 @@ +--- +features: + - Made the Angular Launch Instance workflow the default + in Horizon. +deprecations: + - The Python Launch Instance workflow has been deprecated + and no longer displays by default. diff --git a/tools/gate/integration/pre_test_hook.sh b/tools/gate/integration/pre_test_hook.sh index 949c990196..cfbbdfc1f7 100755 --- a/tools/gate/integration/pre_test_hook.sh +++ b/tools/gate/integration/pre_test_hook.sh @@ -2,3 +2,6 @@ # This script will be executed inside pre_test_hook function in devstack gate +cd /opt/stack/new/horizon/openstack_dashboard/local/local_settings.d +mv _20_integration_tests_scaffolds.py.example _20_integration_tests_scaffolds.py +sudo service apache2 restart