hercules-team / python-augeas

Python bindings for Augeas
GNU Lesser General Public License v2.1
44 stars 31 forks source link

match() - adding option to match the value in addition to the path. #37

Closed martinhoyer closed 6 years ago

martinhoyer commented 6 years ago

augtool has this functionality

thedrow commented 6 years ago

I'm not sure this is a valid feature because you can create an XPath expression to match by value. @lutter Any thoughts?

If it is, would you mind adding a test for this functionality?

lutter commented 6 years ago

Yes, this is the same as adding a [. = 'value'] filter to the end of the path expression, e.g., match /files/etc/hosts/*/ipaddr[. = '127.0.0.1']. The existing feature in match is more versatile since you can e.g. do stuff like match /files/etc/hosts/*[ipaddr='127.0.0.1']/canonical to find the canonical name of the host with ipaddr 127.0.0.1

martinhoyer commented 6 years ago

I see, didn't know that. Thanks @lutter!