From 2cc3ef2d12653f93977d8195cfa66aad534a827a Mon Sep 17 00:00:00 2001 From: nhertz <nhertz@nrao.edu> Date: Wed, 10 Nov 2021 10:30:14 -0700 Subject: [PATCH] Change [SendMessage: qa_ready] action to new [AnnounceQa] action that will correctly announce that QA is ready using REST --- ..._change_sendmessage_qa_ready_action_to_.py | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 schema/versions/ced8e001d262_change_sendmessage_qa_ready_action_to_.py diff --git a/schema/versions/ced8e001d262_change_sendmessage_qa_ready_action_to_.py b/schema/versions/ced8e001d262_change_sendmessage_qa_ready_action_to_.py new file mode 100644 index 000000000..ee2b9787c --- /dev/null +++ b/schema/versions/ced8e001d262_change_sendmessage_qa_ready_action_to_.py @@ -0,0 +1,51 @@ +"""change SendMessage qa_ready action to AnnounceQa action + +Revision ID: ced8e001d262 +Revises: acfdeb6777cb +Create Date: 2021-11-10 10:16:09.070171 + +""" +from alembic import op + +# revision identifiers, used by Alembic. +revision = "ced8e001d262" +down_revision = "acfdeb6777cb" +branch_labels = None +depends_on = None + + +def upgrade(): + """ + Modify action that gets triggered on QA workflow complete; + Change it to perform the AnnounceQa action instead of attempting to SendMessage with arguments qa_ready + """ + op.execute( + """ + UPDATE capability_state_actions SET action_type = 'AnnounceQa', arguments = null + WHERE action_type = 'SendMessage' + AND arguments = 'qa_ready' + AND transition_id = ( + SELECT transition_id FROM capability_state_transitions + WHERE pattern = 'type == workflow-complete' + AND capability_name = 'std_calibration' + ) + """ + ) + + +def downgrade(): + """ + Undo above change + """ + op.execute( + """ + UPDATE capability_state_actions SET action_type = 'SendMessage', arguments = 'qa_ready' + WHERE action_type = 'AnnounceQa' + AND arguments IS null + AND transition_id = ( + SELECT transition_id FROM capability_state_transitions + WHERE pattern = 'type == workflow-complete' + AND capability_name = 'std_calibration' + ) + """ + ) -- GitLab