-
Notifications
You must be signed in to change notification settings - Fork 726
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
Implements accessing the UUIDs of a config items by tag reference #2665
Conversation
Even tried creating a new branch to prevent those previous commits getting tangled up with this PR here - oh, git... |
for uuid in self._template_in_data['__uuid__']: | ||
if self._template_in_data['__uuid__'][uuid] == item: | ||
uuids.append(uuid) | ||
return uuids |
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.
should be done for a single element
This updated diff makes it more explicit about there the |
@ndejong if we add the attributes to the object, would that be sufficient for you? I'm not sure we should add an extractor for all uuids if most use-cases need the uuid of the item traversing. |
@AdSchellevis - I'm probably happy with any solution that is clear and easy to use. If step back for a moment and consider why I wrote an extractor - As a relative newbie in the OPNsense codebase I felt like I wanted a solution that made the templates easier to write and understand. To get there I first dug through other templates and then through code to discover the data-structures inside the template helpers at which point it did not occur to me that I could simply use the item object itself as the comparator as @fabianfrz pointed out in the Nginx work around - my extractor uses the same approach. The idea of injecting a special I'm perhaps biased here, but I feel like the explicit function that does what it says Totally your call. |
@AdSchellevis the uuid as a property would be exactly what I need. be careful because you may overwrite data. In PHP i get it as [(at) attibutes]["uuid"]. The advantage is, that an @ cannot be a valid XML tag. |
@fabianfrz I know, As soon as I have a proper fix, I'll post it in the issue #2664 and close this one when done. |
@ndejong @fabianfrz this 3add6c7 should do the trick. To use a uuid, just use something similar to:
|
Most excellent indeed |
@ndejong can I close this pull request? |
@AdSchellevis yes please do |
Raised as issue #2664
Discussed in forum here