[augeas-devel] Problems creating _almost empty_ file
David Lutterkort
lutter at watzmann.net
Fri Aug 10 21:06:18 UTC 2018
Hi Štěpán,
On Thu, Aug 2, 2018 at 8:45 AM, Štěpán Balážik <stepan.balazik at nic.cz>
wrote:
> Now, when I want to create similar *programmatically *using augtool I run
> into this:
>
> $ augtool
> augtool> set tmp/test2.min/file
> augtool> save
> error: Failed to execute command
> saving failed (run 'errors' for details)
> augtool> errors
> Error in /tmp/test2.min:1.0 (parse_skel_failed)
> Input string does not match at all
> Lens: /usr/share/augeas/lenses/minimal.aug:8.10-.142:
>
> When I was trying to create empty (or almost empty) file like this one
> using the lenses distributed with Augeas (the one for /etc/hosts for
> example) I ran to no such problems so I suppose I am doing something wrong.
>
The problem you are running into is that Augeas parses the original file
right before it saves changes; that is necessary to recover things that are
in the file but not in the tree, like whitespace. Your lens does not accept
an empty file, it requires that a file contains, at a minimum,
"BEGIN\nEND\n". If you change your lens to accept an empty file (e.g., by
putting a '?' at the end of your definition of lns), all should be well.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20180810/f5f4d6ed/attachment.htm>
More information about the augeas-devel
mailing list