diff --git a/tuskar_ui/api/heat.py b/tuskar_ui/api/heat.py index 8203a66ba..869d60edd 100644 --- a/tuskar_ui/api/heat.py +++ b/tuskar_ui/api/heat.py @@ -289,13 +289,21 @@ class Stack(base.APIResourceWrapper): @cached_property def is_deploying(self): - """Check if this Stack is currently deploying or updating. + """Check if this Stack is currently deploying. :return: True if deployment is in progress, False otherwise. :rtype: bool """ - return self.stack_status in ('CREATE_IN_PROGRESS', - 'UPDATE_IN_PROGRESS') + return self.stack_status in ('CREATE_IN_PROGRESS',) + + @cached_property + def is_updating(self): + """Check if this Stack is currently updating. + + :return: True if updating is in progress, False otherwise. + :rtype: bool + """ + return self.stack_status in ('UPDATE_IN_PROGRESS',) @cached_property def is_failed(self): diff --git a/tuskar_ui/infrastructure/overview/views.py b/tuskar_ui/infrastructure/overview/views.py index 1302fa03a..12f3ff827 100644 --- a/tuskar_ui/infrastructure/overview/views.py +++ b/tuskar_ui/infrastructure/overview/views.py @@ -203,7 +203,7 @@ class IndexView(horizon.forms.ModalFormView, StackMixin): context['progress'] = min(95, max( 5, 100 * float(resources_count) / total_num_nodes_count)) - elif stack.is_deploying: + elif stack.is_deploying or stack.is_updating: total = sum(d['total_node_count'] for d in roles) context['progress'] = min(95, max( 5, 100 * sum(float(d.get('deployed_node_count', 0)) diff --git a/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_progress.html b/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_progress.html index 27910b58a..acfdd9ddf 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_progress.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_progress.html @@ -11,6 +11,8 @@ {% trans "Undeploying..." %} {% elif stack.is_deploying %} {% trans "Deploying..." %} + {% elif stack.is_updating %} + {% trans "Updating..." %} {% endif %} {% endblock %} @@ -33,7 +35,7 @@ {% endblock %} {% block deployment-buttons %} - {% if stack.is_deploying %} + {% if stack.is_deploying or stack.is_updating %} diff --git a/tuskar_ui/infrastructure/templates/infrastructure/overview/index.html b/tuskar_ui/infrastructure/templates/infrastructure/overview/index.html index c27b23177..fa4273cc6 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/overview/index.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/overview/index.html @@ -12,7 +12,7 @@
{% if stack %} - {% if stack.is_deleting or stack.is_deploying %} + {% if stack.is_deleting or stack.is_deploying or stack.is_updating %} {% include "infrastructure/overview/deployment_progress.html" %} {% elif stack.is_delete_failed or stack.is_failed %} {% include "infrastructure/overview/deployment_failed.html" %} diff --git a/tuskar_ui/test/api_tests/heat_tests.py b/tuskar_ui/test/api_tests/heat_tests.py index 2f9cf6f6b..609ff9446 100644 --- a/tuskar_ui/test/api_tests/heat_tests.py +++ b/tuskar_ui/test/api_tests/heat_tests.py @@ -68,6 +68,16 @@ class HeatAPITests(test.APITestCase): ret_val = stack.is_deployed self.assertFalse(ret_val) + def test_stack_is_updating(self): + stack = api.heat.Stack(self.heatclient_stacks.first()) + ret_val = stack.is_updating + self.assertFalse(ret_val) + + def test_stack_is_deploying(self): + stack = api.heat.Stack(self.heatclient_stacks.first()) + ret_val = stack.is_deploying + self.assertFalse(ret_val) + @unittest.skip("Add appropriate test data to deal with nested stacks.") def test_stack_resources(self): stack = api.heat.Stack(self.heatclient_stacks.first(),