Fix 500 error when fetch data about deleted stack

Currnetly, request of dashboard to Horizon API works only for existing
stack. Request about deleted stack fails with 500 status. Proposed patch
fixes it

Story: 2009731
Task: 44148
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ia6ef4459ab8c4c8f3f08e7c655c894cb152238da
This commit is contained in:
Vadym Markov 2021-12-08 14:58:49 +02:00
parent dcaa644bdc
commit b7f3dcc774

View File

@ -12,25 +12,25 @@
import json
from heatclient.v1 import stacks
from heat_dashboard.api import heat
from heat_dashboard.content.stacks import mappings
from heat_dashboard.content.stacks import sro
class Stack(object):
pass
def d3_data(request, stack_id=''):
try:
stack = heat.stack_get(request, stack_id)
except Exception:
stack = Stack()
stack.id = stack_id
stack.stack_name = request.session.get('stack_name', '')
stack.stack_status = 'DELETE_COMPLETE'
stack.stack_status_reason = 'DELETE_COMPLETE'
stack_data = {
'id': stack_id,
'stack_name': request.session.get('stack_name', ''),
'stack_status': 'DELETE_COMPLETE',
'stack_status_reason': 'DELETE_COMPLETE',
}
stack = stacks.Stack(stacks.StackManager(None), stack_data)
try:
resources = heat.resources_list(request, stack.stack_name)