[augeas-devel] Re: ANNOUNCE: Augeas 0.4.0

David Lutterkort lutter at redhat.com
Tue Feb 10 17:53:56 UTC 2009


On Mon, 2009-02-09 at 16:33 +0100, Louis Coilliot wrote:
> # cat test-augeas.py
> #!/usr/bin/python
> from augeas import Augeas
> aug=Augeas()
> path='/files/etc/ssh/sshd_config/PermitRootLogin/'

The problem is the trailing slash: Augeas got a little pickier about the
syntax of path expressions, and doesn't allow trailing slashes any more.

If you get an error from any of the Augeas calls, it's a good idea to
look for nodes '/augeas//error', something like

        try:
          print aug.match(path)
        except Exception, e:
          print str(e)
          for p in aug.match("/augeas//error/descendant-or-self::*"):
              print "%s = %s" % (p, aug.get(p))

BTW, you won't see this behavior in augtool, since augtool cleans up
paths by removing the trailing slash.

David





More information about the augeas-devel mailing list