Open nmaludy opened 7 years ago
@nmaludy Interesting. We don't resolve jinja aprior because some of those parameters for the rule can come from the payload of incoming trigger. Looks like we need to do jinja resolution prior to registration and prior to "enforcing" the rule. I am looking into this but wanted to ack that I see the same stack trace.
@lakshmi-kannan
Use case, and why this originated:
I wrote (and still am in the process of finalizing) a pack that performs a backup of StackStorm. I would really love to publish this on the exchange, but in doing so i'm going to need to make an "executive decision" as to what cron schedule the backup should be performed on. If the user downloads/installs this pack and modifies the rule manually, then the next update they do will overwrite this change back to the value in the pack from exchange.
Ideally what i would like to do is store this information in either a config option or datastore key/value. Then, the user can install the pack and either update a config and/or a datastore key/value to set their schedule. Now, when the pack is update it will maintain the schedule the user wants for their backups.
This happens to be a common pattern not just for backups, but for several other (currently 6 on my plate) scheduled/cron tasks that i am working on.
@nmaludy
What is your expectations on changing config or KV parameters used in the rules for triggers? Would it be confusing to you if you changed KV and find that the trigger parameters have not updated? Will you easily find the current acting values of trigger parameters? Will you know what to do for the new KV or config parameters to take effect?
cc @lakshmi-kannan - we want to clear our concerns with potential confusion the JINJA parameters may cause so best it to hear from the real user :)
Thanks!
@dzimine @lakshmi-kannan
Q: What is your expectations on changing config or KV parameters used in the rules for triggers?
A: I think it's reasonable to treat this similar to loading/reloading config values for actions. Recently we added a note to many of the pack README files to say something along the lines of "when changing values in the config, please make sure to run an st2ctl reload --register-all
". If we document this properly, i think the confusion would be minimized.
Q: Would it be confusing to you if you changed KV and find that the trigger parameters have not updated? A: I don't think so, as long as it's documented properly. Trying to think about how to implement this by "automatically discovering", and you would have to either do it on a polling basis (easy, but semi-painful), or some magic with dependency graphs that know to update certain rules when specific K/V change (hard).
Q: Will you easily find the current acting values of trigger parameters?
A: If the current values are rendered in st2 rule get xxx
i don't think it would be to difficult to diagnose. Also would be interesting if this could show what Jinja they're rendered from, to differentiate them in some way from "static values" (not a requirement, but just a thought)?
Q: Will you know what to do for the new KV or config parameters to take effect? A: Again, i think this is a documentation and/or training piece if it's not handled in an automatic way.
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.
Still an issue
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.
Still an issue.
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.
I have a rule that i'm trying to define using a cron timer with values from the key/value store.
When i try to register the rule i get the following error in
st2api
logs.