-
-
Notifications
You must be signed in to change notification settings - Fork 782
RFR: Fix action registration validation #932
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
Conversation
7063f3e to
a5d1661
Compare
|
Nice. I believe there is a same issue with rules - we don't perform the same validation on the way in and out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find those ifs slightly confusing.
It seems like we always want to use pack argument which is passed to the method so those ifs are redundant / confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, action metadata doesn't need and shouldn't define pack attribute anyway, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That is why all these ifs are needed. If metadata doesn't contain a pack field. we add it. The case where user specifies a pack_field but doesn't match the folder it's coming from is an interesting case. I currently throw an exception. We can silently ignore the pack field and override it with the pack but that might confuse the user.
On a related note, st2 action create /full/path seems to register actions in default pack. In that case, pack field is required if you want that model to go into right pack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks, I got it - we need to support a use case of specifying a pack in case user explicitly registers an action using the API.
Maybe it would be good to document this here :)
|
Tried to test this branch and everything blew up after I ran register-content script. It looks like that again, same as the previous PR, this branch changes behavior - we don't update existing actions anymore on register content. This needs to be fixed so we preserve the old behavior with updating actions on registering. |
|
I also need to have a look how my tests which I've added recently didn't catch that. They should catch this problem :/ |
…nd update st2ctl reload command to pass --register-sensors --register-actions flags to the command if user doesn't specify which resource to register.
* A runner param can be declared immutable in action. In this case, we can use the 'default' value supplied in either runner or action. We need default to be specified in at least one place.
* Default value for a runner param made immutable in either runner or action can also come from either.
Fix st2 packs actions
…ation RFR: Fix action registration validation
Action registration now uses same validation as actions API. This will fix a lot of issues where registration can let some models pass through but actions list API will break.