[augeas-devel] sudoers lens not working
David Lutterkort
lutter at redhat.com
Fri Mar 20 22:02:02 UTC 2009
On Thu, 2009-03-19 at 19:50 -0700, Robin Lee Powell wrote:
> I've gotta say that Augeas' parse errors are generally entirely unhelpful:
>
> augtool> ls /augeas/files/etc/sudoers/error/
> pos = 2587
> message = Short iteration
Thinking about that a little more, it occurred to me that it's pretty
easy to calculate the line number from pos after the error happened
(assuming that a 'line' ends with a '\n')
I also changed the error message 'Short iteration' to something
hopefully a little clearer.
And finally, I also add to the error which lens exactly failed, in case
you want to go digging thorugh your .aug file.
With that, when you have an invalid /etc/hosts, you get:
/augeas/files/etc/hosts/error = "parse_failed"
/augeas/files/etc/hosts/error/pos = "266"
/augeas/files/etc/hosts/error/line = "6"
/augeas/files/etc/hosts/error/char = "0"
/augeas/files/etc/hosts/error/lens = "lenses/hosts.aug:22.12-.42"
/augeas/files/etc/hosts/error/message = "Iterated lens matched less than it should"
and if you mutilate your tree, e.g. by doing
'clear /files/etc/hosts/1/ipaddr' and then save, you get:
/augeas/files/etc/hosts/error = "put_failed"
/augeas/files/etc/hosts/error/path = "/files/etc/hosts/1/ipaddr"
/augeas/files/etc/hosts/error/lens = "lenses/hosts.aug:17.49-.60"
/augeas/files/etc/hosts/error/message = "Can not store a nonexistent (NULL) value"
> It's the one thing I don't like about it. At least give me a line
> number. :(
Does the above mean you have to look for something else to dislike ? ;)
David
More information about the augeas-devel
mailing list