Skip to content

Various v2.9.0 changes #4337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
4 changes: 3 additions & 1 deletion st2api/st2api/controllers/v1/action_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def _get_one(action_id, requester_user):
GET /actions/views/parameters/1
"""
action_db = LookupUtils._get_action_by_id(action_id)
LOG.info('Found action: %s, runner: %s', action_db, action_db.runner_type['name'])
Copy link
Member Author

@Kami Kami Sep 11, 2018

Choose a reason for hiding this comment

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

This reduces duration of this request for 10 seconds where there are many actions in the database.

There is no need to log this, especially under INFO.


permission_type = PermissionType.ACTION_VIEW
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
Expand Down Expand Up @@ -144,6 +143,9 @@ def get_all(self, exclude_attributes=None, include_attributes=None, sort=None, o
result = []
for item in resp.json:
action_api = ActionAPI(**item)
# TODO: This is extreme inefficient and results in N * 2 queries where N is number of
Copy link
Member Author

Choose a reason for hiding this comment

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

This is simply horrible, with aws and some other packs API endpoint takes 30+ seconds to return (well, now 10 seconds less with logging fix, but still too long).

# actions
# Refactor it to perform 2 queries instead
result.append(self._transform_action_api(action_api=action_api,
requester_user=requester_user))
resp.json = result
Expand Down
3 changes: 2 additions & 1 deletion st2api/st2api/controllers/v1/actionexecutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class ActionExecutionsControllerMixin(BaseRestControllerMixin):
# parameters
mandatory_include_fields_retrieve = [
'action.parameters',
'runner.runner_parameters'
'runner.runner_parameters',
'parameters'
]

# A list of attributes which can be specified using ?exclude_attributes filter
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/models/db/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def mask_secrets(self, value):
parameters.update(value.get('runner', {}).get('runner_parameters', {}))

secret_parameters = get_secret_parameters(parameters=parameters)
result['parameters'] = mask_secret_parameters(parameters=result['parameters'],
result['parameters'] = mask_secret_parameters(parameters=result.get('parameters', {}),
Copy link
Member Author

Choose a reason for hiding this comment

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

Noticed this issue while testing WebUI changes.

secret_parameters=secret_parameters)

if 'parameters' in liveaction:
Expand Down