[augeas-devel] Problem with function save of python binding for augeas (need to save twice)

David Lutterkort lutter at redhat.com
Mon Nov 3 19:10:21 UTC 2008


Hi Louis,

On Sun, 2008-11-02 at 22:41 +0100, Louis Coilliot wrote:

First off, what versions of Augeas and python-augeas are you using ?
(And on what OS) ?

> This fails:
> 
> #!/usr/bin/python
> from augeas import augeas
> auginstance=augeas()
> auginstance.set('/files/etc/ssh/sshd_config/PermitRootLogin','no')
> auginstance.save()
> 
> Output:
> Traceback (most recent call last):
>   File "./test.py", line 10, in ?
>     auginstance.save()
>   File "/usr/lib/python2.4/site-packages/augeas.py", line 266, in save
>     raise IOError, "Unable to save to file!"
> IOError: Unable to save to file!

What do

        auginstance.match('/augeas/files/etc/ssh/sshd_config/error/*')
        auginstance.match('/augeas/files/etc/ssh/sshd_config/error/*/*')
        
return after the error ?

> But there's more. This works:
> 
> from augeas import augeas
> auginstance=augeas()
> auginstance.set('/files/etc/ssh/sshd_config/PermitRootLogin','no')
> try:
>     auginstance.save()
> except:
>     pass
> auginstance.save()
> 
> I need to save twice. Always.
> 
> When it succeeds, the change is saved.

That is _very_ weird. I'll have a better idea once you send me the info
above.

David





More information about the augeas-devel mailing list