-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add this.callers_promisers variable #2301
Add this.callers_promisers variable #2301
Conversation
Can one of the admins verify this patch? |
This is a brilliant idea, but I would rather make it @this.context@ and a data container so it can hold all the information about the stack. Do you think that's possible? |
Intresting idea, @tzz. What other information about the stack are you thinking of? I see at least the names of calling bundles as well (this currently is just promisers, not bundle names), but can't think of anything else right now. |
I would include everything I can from the
Plus
Because it's a data container, the format is flexible so it can get even more useful over time. |
I like the idea of it being a data container with more info. And I think this is a great feature. |
Also I would add the parameters passed to each body or bundle or promise along the stack path. @amousset please let us know if you're interested in working on this. |
I tried using a data container, but found out it was difficult to extract the data I needed in CFEngine code (namely the ordered list of parent methods promisers). I can still add more variablesto this PR (like bundle names) to cover more use-cases. |
@amousset can you start with a data container (JSON data structure) to hold the call stack? That's a simple change. Make it a
I think it's a good change; see After that change, others can keep augmenting this variable since it's a JSON data container and keys can be inserted at will. |
With this approach it is complicated to extract the promiser stack. With the slist approach I can do:
I'm not against the use of data container, but to expand their usage, you need convenient functions to extract data, by example a function like this:
|
@peckpeck I agree 100%, hence you should vote for https://dev.cfengine.com/issues/7435 by watching it. It's the best way to get what you're describing. In 3.7, the @amousset ping? |
I will, jq is a very good feature! |
(Sorry for the digression, but it's related to this PR) @peckpeck yes,
|
I think there is nothing wrong with doing both. Having a plain list is certainly convenient, even if a data container is also available. How about |
(Then we could also split the work and not do both at once) |
Ok, closing this one in favor of #2331 then. |
Ref: https://dev.cfengine.com/issues/7493
With methods, we can re-utilize common configuration pieces from different places. But it is currently impossible to identify, within the called bundle, what is the
context of the call, and hence difficult to produce meaningful logs or reporting, particularly when bundles are called with the same arguments.
A way to make it possible to know the context would be to create a new context variable, for example called this.callers_promisers, which would be a list of the parents promisers of the current bundle.
This way we can use the full call stack to identify uniquely the current action.