Skip to content

Commit 27197fe

Browse files
committed
Build a hash when updating stack state and state_reason
Signed-off-by: Rashed Kamal <rashed.kamal@broadcom.com>
1 parent 1efc8c4 commit 27197fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/actions/stack_update.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ def initialize(user_audit_info)
1212

1313
def update(stack, message)
1414
stack.db.transaction do
15-
stack.update(state: message.state) if message.requested?(:state)
16-
stack.update(state_reason: message.state_reason) if message.requested?(:state_reason)
15+
stack_updates = {}
16+
stack_updates[:state] = message.state if message.requested?(:state)
17+
stack_updates[:state_reason] = message.state_reason if message.requested?(:state_reason)
18+
stack.update(stack_updates) if stack_updates.any?
19+
1720
MetadataUpdate.update(stack, message)
1821
Repositories::StackEventRepository.new.record_stack_update(stack, @user_audit_info, message.audit_hash)
1922
end

0 commit comments

Comments
 (0)