Skip to content

Commit eb3b4bb

Browse files
authored
Merge pull request #5489 from StackStorm/revert-5459-add_user_context
Revert "Add status changed by user info to context"
2 parents 451b5ae + 450dfcb commit eb3b4bb

File tree

4 files changed

+4
-30
lines changed

4 files changed

+4
-30
lines changed

CHANGELOG.rst

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ Added
1111

1212
Contributed by @khushboobhatia01
1313

14-
* Added cancel/pause/resume requester information to execution context. #5459
15-
16-
Contributed by @khushboobhatia01
17-
1814
Fixed
1915
~~~~~
2016

contrib/runners/orquesta_runner/tests/unit/test_cancel.py

-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def test_cancel(self):
118118
lv_ac_db, ac_ex_db = ac_svc.request_cancellation(lv_ac_db, requester)
119119
lv_ac_db = lv_db_access.LiveAction.get_by_id(str(lv_ac_db.id))
120120
self.assertEqual(lv_ac_db.status, ac_const.LIVEACTION_STATUS_CANCELING)
121-
self.assertEqual(lv_ac_db.context["cancelled_by"], requester)
122121

123122
def test_cancel_workflow_cascade_down_to_subworkflow(self):
124123
wf_meta = base.get_wf_fixture_meta_data(TEST_PACK_PATH, "subworkflow.yaml")

contrib/runners/orquesta_runner/tests/unit/test_pause_and_resume.py

-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def test_pause(self):
118118
lv_ac_db, ac_ex_db = ac_svc.request_pause(lv_ac_db, cfg.CONF.system_user.user)
119119
lv_ac_db = lv_db_access.LiveAction.get_by_id(str(lv_ac_db.id))
120120
self.assertEqual(lv_ac_db.status, ac_const.LIVEACTION_STATUS_PAUSING)
121-
self.assertEqual(lv_ac_db.context["paused_by"], cfg.CONF.system_user.user)
122121

123122
@mock.patch.object(ac_svc, "is_children_active", mock.MagicMock(return_value=True))
124123
def test_pause_with_active_children(self):
@@ -526,7 +525,6 @@ def test_resume(self):
526525
workflow_execution=str(wf_ex_dbs[0].id)
527526
)
528527
self.assertEqual(len(tk_ex_dbs), 2)
529-
self.assertEqual(lv_ac_db.context["resumed_by"], cfg.CONF.system_user.user)
530528

531529
def test_resume_cascade_to_subworkflow(self):
532530
wf_meta = base.get_wf_fixture_meta_data(TEST_PACK_PATH, "subworkflow.yaml")

st2common/st2common/services/action.py

+4-23
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,7 @@ def request(liveaction):
214214

215215

216216
def update_status(
217-
liveaction,
218-
new_status,
219-
result=None,
220-
publish=True,
221-
set_result_size=False,
222-
context=None,
217+
liveaction, new_status, result=None, publish=True, set_result_size=False
223218
):
224219
if liveaction.status == new_status:
225220
return liveaction
@@ -231,7 +226,6 @@ def update_status(
231226
"status": new_status,
232227
"result": result,
233228
"publish": False,
234-
"context": context,
235229
}
236230

237231
if new_status in action_constants.LIVEACTION_COMPLETED_STATES:
@@ -310,10 +304,7 @@ def request_cancellation(liveaction, requester):
310304
else:
311305
status = action_constants.LIVEACTION_STATUS_CANCELED
312306

313-
liveaction.context["cancelled_by"] = requester
314-
liveaction = update_status(
315-
liveaction, status, result=result, context=liveaction.context
316-
)
307+
liveaction = update_status(liveaction, status, result=result)
317308

318309
execution = ActionExecution.get(liveaction__id=str(liveaction.id))
319310

@@ -355,12 +346,7 @@ def request_pause(liveaction, requester):
355346
% liveaction.id
356347
)
357348

358-
liveaction.context["paused_by"] = requester
359-
liveaction = update_status(
360-
liveaction,
361-
action_constants.LIVEACTION_STATUS_PAUSING,
362-
context=liveaction.context,
363-
)
349+
liveaction = update_status(liveaction, action_constants.LIVEACTION_STATUS_PAUSING)
364350

365351
execution = ActionExecution.get(liveaction__id=str(liveaction.id))
366352

@@ -404,12 +390,7 @@ def request_resume(liveaction, requester):
404390
'not in "paused" state.' % (liveaction.id, liveaction.status)
405391
)
406392

407-
liveaction.context["resumed_by"] = requester
408-
liveaction = update_status(
409-
liveaction,
410-
action_constants.LIVEACTION_STATUS_RESUMING,
411-
context=liveaction.context,
412-
)
393+
liveaction = update_status(liveaction, action_constants.LIVEACTION_STATUS_RESUMING)
413394

414395
execution = ActionExecution.get(liveaction__id=str(liveaction.id))
415396

0 commit comments

Comments
 (0)