[augeas-devel] sudoers lens not working

Robin Lee Powell rlpowell at digitalkingdom.org
Sat Mar 21 04:32:14 UTC 2009


On Fri, Mar 20, 2009 at 03:02:02PM -0700, David Lutterkort wrote:
> 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 ? ;)

*Dude*.

That is *so* great!  Thank you so much!  Point me to a wishlist or
something.

I feel bad even saying this, but would it be possible to break out
"lenses/hosts.aug:17.49-.60" into something more clear?  I'm
assuming that's something like "line 17 of lenses/hosts.aug,
characters 49-60"?

-Robin

-- 
They say:  "The first AIs will be built by the military as weapons."
And I'm thinking:  "Does it even occur to you to try for something
other than the default outcome?" -- http://shorl.com/tydruhedufogre
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/




More information about the augeas-devel mailing list