Skip to content

Conversation

@rbu9fe
Copy link

@rbu9fe rbu9fe commented Nov 4, 2025

When an xpath is set then the sysrepo API already provides only filtered changes. Reapplying the filter doesn't work when the filter element is not part of the result.

For example, the xpath "/ietf-interfaces:interfaces/interface[type='iana-if-type:ethernetCsmacd']/enabled" subscribes for changes of the 'enabled' leaf but 'type' is not part of the result, in which case get_changes(xpath + '//.', ...) will always be empty!

Hence, leave root path empty when an xpath is set to avoid invalid filtering!

When an xpath is set then the sysrepo API already provides only filtered changes. Reapplying the filter doesn't work when the filter element is not part of the result.

For example, the xpath "/ietf-interfaces:interfaces/interface[type='iana-if-type:ethernetCsmacd']/enabled"
subscribes for changes of the 'enabled' leaf but 'type' is not part of the result, in which case get_changes(xpath + '//.', ...) will always be empty!

Hence, leave root path empty when an xpath is set to avoid invalid filtering!
@rbu9fe
Copy link
Author

rbu9fe commented Nov 7, 2025

Actually that change is also not that nice as then the caller always gets all changes and not only the ones he subscribed for. The proper solution is to not collect the changes for the user but rather pass the session to the callback as a parameter so that the usre can query the changes he actually wants, which may only be a subset of what he subscribed for.
I'll close that PR and come up with a modified variant.

@rbu9fe rbu9fe closed this Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant