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 <tsufiev@mirantis.com>
Change-Id: Id0c57b33df46397711e32092cec6cc5268841779
Implements: blueprint enable-angular-launch-instance
This commit is contained in:
Rob Cresswell 2016-03-03 10:55:26 +00:00
parent 721c963b9d
commit 2843ce3c0a
12 changed files with 68 additions and 13 deletions

3
.gitignore vendored
View File

@ -20,6 +20,9 @@ reports
openstack_dashboard/local/* openstack_dashboard/local/*
!openstack_dashboard/local/local_settings.py.example !openstack_dashboard/local/local_settings.py.example
!openstack_dashboard/local/enabled/_50__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/.secret_key_store
openstack_dashboard/test/integration_tests/local-horizon.conf openstack_dashboard/test/integration_tests/local-horizon.conf
openstack_dashboard/wsgi/horizon.wsgi openstack_dashboard/wsgi/horizon.wsgi

View File

@ -630,6 +630,45 @@ properties found in the Launch Instance modal.
The ``config_drive`` setting specifies the default value for the Configuration The ``config_drive`` setting specifies the default value for the Configuration
Drive property. 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`` ``MESSAGES_PATH``
----------------- -----------------

View File

@ -331,9 +331,9 @@ class ImagesTable(tables.DataTable):
verbose_name = _("Images") verbose_name = _("Images")
table_actions = (OwnerFilter, CreateImage, DeleteImage,) table_actions = (OwnerFilter, CreateImage, DeleteImage,)
launch_actions = () launch_actions = ()
if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True): if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False):
launch_actions = (LaunchImage,) + launch_actions 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 launch_actions = (LaunchImageNG,) + launch_actions
row_actions = launch_actions + (CreateVolumeFromImage, row_actions = launch_actions + (CreateVolumeFromImage,
EditImage, UpdateMetadata, EditImage, UpdateMetadata,

View File

@ -115,7 +115,7 @@ class ImagesAndSnapshotsTests(test.TestCase):
# first instance - status active, owned # first instance - status active, owned
self.assertEqual(len(row_actions), 5) 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[1].verbose_name, u"Create Volume")
self.assertEqual(row_actions[2].verbose_name, u"Edit Image") self.assertEqual(row_actions[2].verbose_name, u"Edit Image")
self.assertEqual(row_actions[3].verbose_name, u"Update Metadata") self.assertEqual(row_actions[3].verbose_name, u"Update Metadata")
@ -125,7 +125,7 @@ class ImagesAndSnapshotsTests(test.TestCase):
# second instance - status active, not owned # second instance - status active, not owned
self.assertEqual(len(row_actions), 2) 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") self.assertEqual(row_actions[1].verbose_name, u"Create Volume")
row_actions = snaps.get_row_actions(snaps.data[2]) row_actions = snaps.get_row_actions(snaps.data[2])

View File

@ -1199,9 +1199,9 @@ class InstancesTable(tables.DataTable):
row_class = UpdateRow row_class = UpdateRow
table_actions_menu = (StartInstance, StopInstance, SoftRebootInstance) table_actions_menu = (StartInstance, StopInstance, SoftRebootInstance)
launch_actions = () launch_actions = ()
if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True): if getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False):
launch_actions = (LaunchLink,) + launch_actions 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 launch_actions = (LaunchLinkNG,) + launch_actions
table_actions = launch_actions + (DeleteInstance, table_actions = launch_actions + (DeleteInstance,
InstancesFilterAction) InstancesFilterAction)

View File

@ -3830,12 +3830,11 @@ class InstanceTests(helpers.TestCase):
res = self.client.get(INDEX_URL) res = self.client.get(INDEX_URL)
launch_action = self.getAndAssertTableAction(res, 'instances', 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)) set(launch_action.classes))
self.assertEqual('Launch Instance', launch_action.verbose_name) self.assertEqual('Launch Instance', launch_action.verbose_name)
self.assertEqual('horizon:project:instances:launch', launch_action.url)
self.assertEqual((('compute', 'compute:create'),), self.assertEqual((('compute', 'compute:create'),),
launch_action.policy_rules) launch_action.policy_rules)
@ -3878,7 +3877,7 @@ class InstanceTests(helpers.TestCase):
res = self.client.get(INDEX_URL) res = self.client.get(INDEX_URL)
launch_action = self.getAndAssertTableAction( launch_action = self.getAndAssertTableAction(
res, 'instances', 'launch') res, 'instances', 'launch-ng')
self.assertTrue('disabled' in launch_action.classes, self.assertTrue('disabled' in launch_action.classes,
'The launch button should be disabled') 'The launch button should be disabled')

View File

@ -210,6 +210,7 @@ class NetworkTopologyCreateTests(test.TestCase):
self._test_new_button_disabled_when_quota_exceeded( self._test_new_button_disabled_when_quota_exceeded(
expected_string, routers_quota=0) expected_string, routers_quota=0)
@test.update_settings(LAUNCH_INSTANCE_LEGACY_ENABLED=True)
@test.create_stubs({quotas: ('tenant_quota_usages',)}) @test.create_stubs({quotas: ('tenant_quota_usages',)})
def test_launch_instance_button_disabled_when_quota_exceeded(self): def test_launch_instance_button_disabled_when_quota_exceeded(self):
url = reverse('horizon:project:network_topology:launchinstance') url = reverse('horizon:project:network_topology:launchinstance')

View File

@ -212,9 +212,9 @@ class NetworkTopologyView(views.HorizonTemplateView):
context['console_type'] = getattr( context['console_type'] = getattr(
settings, 'CONSOLE_TYPE', 'AUTO') settings, 'CONSOLE_TYPE', 'AUTO')
context['show_ng_launch'] = getattr( context['show_ng_launch'] = getattr(
settings, 'LAUNCH_INSTANCE_NG_ENABLED', False) settings, 'LAUNCH_INSTANCE_NG_ENABLED', True)
context['show_legacy_launch'] = getattr( context['show_legacy_launch'] = getattr(
settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', True) settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False)
return context return context

View File

@ -0,0 +1,3 @@
# Enable both Launch Instance wizards for the sake of testing
LAUNCH_INSTANCE_LEGACY_ENABLED = True
LAUNCH_INSTANCE_NG_ENABLED = True

View File

@ -64,7 +64,7 @@ class ImagesTable(tables.TableRegion):
self.driver, self.conf, self.driver, self.conf,
field_mappings=self.CREATE_VOLUME_FROM_IMAGE_FORM_FIELDS) 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): def launch_instance(self, launch_instance, row):
launch_instance.click() launch_instance.click()
return forms.TabbedFormRegion( return forms.TabbedFormRegion(

View File

@ -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.

View File

@ -2,3 +2,6 @@
# This script will be executed inside pre_test_hook function in devstack gate # 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