Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion st2common/st2common/services/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ def request_action_execution(wf_ex_db, task_ex_db, st2_ctx, ac_ex_req, delay=Non
# Identify the runner for the action.
runner_type_db = action_utils.get_runnertype_by_name(action_db.runner_type['name'])

# Identify action reference
action_ref = task_ex_db.task_spec.get('spec').get('action')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already an action_ref at line 519. They're not the same?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not address this yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not the same. line 519 is get block of action data from action_execution_d_b. This is get action_ref = pack_name:action_name

Not sure about You did not address this yet. means. Changed if else block to one line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line numbers may have shifted. But if you go down two line from def request_action_execution(wf_ex_db, task_ex_db, st2_ctx, ac_ex_req, delay=None), there's already an action_ref assigned. Is it different than the action_ref begin assigned in this line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if they are not the same, then you just overwrote action_ref that is saved to LiveActionDB below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is different. Changed my variable name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just manually tested this and they are the same value. Can you show me an example where they are different.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I thought it is reading ActionExecution.action. Put log message and tested. Committed change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Good you finally see it. I thought maybe I'm not clear enough.


# Set context for the action execution.
ac_ex_ctx = {
'pack': st2_ctx.get('pack'),
Expand All @@ -545,7 +548,8 @@ def request_action_execution(wf_ex_db, task_ex_db, st2_ctx, ac_ex_req, delay=Non
'task_execution_id': str(task_ex_db.id),
'task_name': task_ex_db.task_name,
'task_id': task_ex_db.task_id
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a comma here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did run nosetests --nocapture st2common/tests/unit/test_param_utils.py and all passed

'ref': action_ref
}

if st2_ctx.get('api_user'):
Expand Down
12 changes: 12 additions & 0 deletions st2common/st2common/util/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def render_live_params(runner_parameters, action_parameters, params, action_cont

pack = action_context.get('pack')
user = action_context.get('user')
action_ref = action_context.get('ref')

try:
config = get_config(pack, user)
Expand All @@ -299,6 +300,17 @@ def render_live_params(runner_parameters, action_parameters, params, action_cont

G = _create_graph(action_context, config)

# Retrieve config for action pack if it is different with parent
if action_ref:
action_pack = action_ref.split('.')[0]
if pack != action_pack:
try:
action_config = get_config(action_pack, user)
G = _create_graph(action_context, action_config)
except Exception as e:
LOG.info('Failed to retrieve action config for pack %s and user %s: %s' % (
action_pack, user, str(e)))

# Additional contexts are applied after all other contexts (see _create_graph), but before any
# of the dependencies have been resolved.
for name, value in six.iteritems(additional_contexts):
Expand Down