Closed mr-falken closed 2 years ago
We proposed for this one to test with global hooks. It's exactly designed for this. I can be based on a request object so you have the context. And then the API can update whatever you want. Did you give a shot?
Yes, that's exactly what we did at the end. :)
It does work as expected with business logic in a awx job template: having that in a "local plugin" - just like field validator - would honestly have been less complex to implement, but I understand that it would need a different architectural approach on squest side.
I close the issue, if this implementation if what you'd like to keep at the moment.
Hi, i'm adding this feature request after a brief discussion on gitter https://gitter.im/HewlettPackard/squest?at=6303423b3a42316d3387c99f
The idea is to possibly add some business logic during the request phase, similar at what happens with field validator.
I'd like to analyze a request before it gets it gets even created, for example with a snippet of python code that checks how many resources that user have already running on my infastructure.
I tried to achieve that with field validators, but as discussed on gitter, it's not possible to get the full context (i.e. logged used, request type, etc) during field validation.
Maybe defining a callback per resource/action that throws a specific exception in case the request is not valid might be fit that need.
Do you think it might be useful ?
Thanks