Skip to content
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

Check and warn if action ref is not present during alias registration #4388

Merged
merged 12 commits into from
Nov 21, 2018

Conversation

lakshmi-kannan
Copy link
Contributor

@lakshmi-kannan lakshmi-kannan commented Oct 12, 2018

fixes: #4372

Registration

2018-10-12 01:46:58,743 INFO [-] =========================================================
2018-10-12 01:46:58,744 INFO [-] ############## Registering aliases ######################
2018-10-12 01:46:58,744 INFO [-] =========================================================
2018-10-12 01:46:58,791 WARNING [-] Action gitlab.get_user not found in DB. Did you forget to register the action?

TODO

  • Fix st2 action-alias create to throw warning
  • Add tests
  • Update CHANGELOG
  • Update Upgrade Notes

@lakshmi-kannan lakshmi-kannan added this to the 3.0.0 milestone Oct 12, 2018
@lakshmi-kannan lakshmi-kannan self-assigned this Oct 12, 2018
@lakshmi-kannan lakshmi-kannan changed the title WIP: Check and warn if action ref is not present during alias registration Check and warn if action ref is not present during alias registration Oct 15, 2018
@lakshmi-kannan lakshmi-kannan changed the title Check and warn if action ref is not present during alias registration WIP: Check and warn if action ref is not present during alias registration Oct 15, 2018
@@ -132,6 +133,13 @@ def _register_action_alias(self, pack, action_alias):
except StackStormDBObjectNotFoundError:
LOG.debug('ActionAlias %s not found. Creating new one.', action_alias)

action_ref = action_alias_db.action_ref

action_db = Action.get_by_ref(action_ref)
Copy link
Member

Choose a reason for hiding this comment

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

Let's see if we can speed this up.

I just made some changes in the past release which improve performance of similar code paths so instead of N queries (where N is number of aliases here) we only perform a single query.

I know this will likely require changing the code around though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kami I want to merge this PR and address bootstrap optimizations as part of another PR that I am working on. If you agree, I'll add tests for this one and try to get this merged?

Copy link
Member

Choose a reason for hiding this comment

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

But please don't forget about it otherwise we will again make one step forward and one step back.

Lakshmi Kannan added 4 commits November 8, 2018 11:20
* master: (202 commits)
  Move from distro check to Python version check.
  Update compile blacklists.
  Fix typo.
  Update st2-self-check and st2ctl to take into account that Mistral is not present on Bionic.
  Don't run flask dev server in threaded mode since it blocks the main loop.
  Allow developer to pass patch_thread argument to the monkey_patch() function.
  Echo flask sensor depends on flask.
  Fix fibonacci sensor so it works under Python 3.
  Fix st2-run-pack-tests so it works under Python 3.
  Revert changes to mongo and some rabbit instrumentation
  Stop raising Python exception when execution result is disabled in action-alias. Port post_result to orquesta for conditional branching. Bumped version to 1.0.1
  Allow user to specify PYTHON_VERSION env variable.
  Add a changelog entry.
  Add a NOTE on old and deprecated timer options.
  Fix an issue with timers engine config options not working as advertised.
  Timers engine options are also used by st2notifier so they need to be registered as common options inside st2common.
  Make sure we correctly pass local timezone specified in the st2.conf to each BlockingScheduler class constructor.
  Remove debug code.
  Make sure we run pack tests under Python 3 on Travis.
  Fix typo.
  ...
@lakshmi-kannan lakshmi-kannan changed the title WIP: Check and warn if action ref is not present during alias registration Check and warn if action ref is not present during alias registration Nov 8, 2018
Lakshmi Kannan added 3 commits November 15, 2018 14:17
* master:
  Fix context related bugs in orquesta
  Use the same approach for statsd as we use for lib2to3.
  Remove code which is not needed.
  Add comment.
  Ignore "Generating grammar tables" log messages generated by 2to3 library used by networkx.
  Update logger format string.
  Don't print statsd log messages unless debug / verbose mode is used.
  Update Circle CI config so we also build bionic packages.
  Update Python action wrapper to silence cryptography deprecation warnings which are printed if user is using older version of Python 2.7.
  Update test dependencies.
  Re-generate requirements files and upgrade to mongoengine 0.16.0.
  Update various dependencies to latest stable versions.
  Refactor orquesta to output on error
* master: (33 commits)
  Update actions registrar to ignore "mistral-v2" runner not found errors which could occur on installations without Mistral.
  Revert "Pass --register-no-fail-on-failure flag to st2ctl in self check when"
  Pass --register-no-fail-on-failure flag to st2ctl in self check when running on distributions with Python 3 without Mistral to avoid errors from workflows in exampels pack which use Mistral runner.
  Remove debug code.
  Allow st2api to work without mistralclient.
  Update the code so it works without mistralclient dependency on installations without Mistral.
  More Python 3 compatibility fixes.
  More Python 3 compatibility fixes.
  Add a test case which verifies metadata_file attribute is also set when registering resources via the API.
  Fix lint.
  Update affected tests.
  Update action alias testing utils so being unable to infer metadata_file attribute is not fatal.
  Not being able to retrieve the metadata_file path should not be datal.
  Make test assertions more strict.
  Update affected tests.
  Update affected test.
  Update code to use a more safe and robust way of obtaining pack resource path which is relative to the pack directory.
  Add use_pack_cache argument to get_pack_base_path and related methods.
  Use more descriptive function name.
  Add tests for "get_relative_path_to_pack" function for which we didn't have any tests yet.
  ...
@lakshmi-kannan lakshmi-kannan merged commit 43e38dd into master Nov 21, 2018
@lakshmi-kannan lakshmi-kannan deleted the issue_4372/alias_warn_no_action branch November 21, 2018 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

action_ref referential integrity not validated for action-alias
2 participants