[augeas-devel] Why does Augeas fail to create new files?
Mol, Xavier (SCC)
xavier.mol at kit.edu
Thu Dec 17 12:32:41 UTC 2015
Hello Augeas experts,
attached you can find the source of a custom lens for Augeas and a file with get and put unit tests; either file is evaluated with augparse successfully. My question is, why can I not create a new file from scratch with that lens, while editing existing files works just fine?
In order to test the steps in between, I used augeas-1.4 and augtool:
[root ~]# augtool --version
augtool 1.4.0 <http://augeas.net/>
Copyright (C) 2007-2011 David Lutterkort
License LGPLv2+: GNU LGPL version 2.1 or later
<http://www.gnu.org/licenses/lgpl-2.1.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David Lutterkort
[root ~]# augtool
augtool> print /augeas/load/StorageAuthzdb/*[label() != "excl"]
/augeas/load/StorageAuthzdb/lens = "@StorageAuthzdb"
/augeas/load/StorageAuthzdb/incl = "/etc/grid-security/storage-authzdb"
---> Currently, the node included with that lens doesn't exist.
augtool> ls /files/etc/grid-security/storage-authzdb
augtool> dump-xml /files/etc/grid-security/storage-authzdb
<augeas match="/files/etc/grid-security/storage-authzdb"/>
---> Creating an empty node works fine, though this should actually fail in my opinion (an empty file is invalid according to the lens).
augtool> touch /files/etc/grid-security/storage-authzdb
augtool> save
Saved 1 file(s)
augtool> ls /files/etc/grid-security
storage-authzdb = (none)
augtool> dump-xml /files/etc/grid-security/storage-authzdb
<augeas match="/files/etc/grid-security/storage-authzdb">
<node label="storage-authzdb" path="/files/etc/grid-security/storage-authzdb"/>
</augeas>
---> Saving the minimal change required for a valid storage-authzdb file fails.
augtool> set /files/etc/grid-security/storage-authzdb/version "2.1"
augtool> dump-xml /files/etc/grid-security/storage-authzdb
<augeas match="/files/etc/grid-security/storage-authzdb">
<node label="storage-authzdb" path="/files/etc/grid-security/storage-authzdb">
<node label="version">
<value>2.1</value>
</node>
</node>
</augeas>
augtool> save
error: Failed to execute command
saving failed (run 'errors' for details)
augtool> errors
Error in /etc/grid-security/storage-authzdb:1.0 (parse_skel_failed)
parse can not process entire input
Lens: /usr/share/augeas/lenses/storageauthzdb.aug:34.12-.75:
---> Starting over...
[root ~]# rm /etc/grid-security/storage-authzdb
rm: remove regular empty file `/etc/grid-security/storage-authzdb'? y
[root ~]# augtool
---> Create the desired tree
augtool> set /files/etc/grid-security/storage-authzdb/version "2.1"
---> Review what the lens would put as a string, which matches what I expect.
augtool> set /in ""
augtool> retrieve StorageAuthzdb.lns /in /files/etc/grid-security/storage-authzdb /out
augtool> print /out
/out = "version 2.1\n"
---> Still saving that output fails
augtool> save
error: Failed to execute command
saving failed (run 'errors' for details)
augtool> errors
Error in /etc/grid-security/storage-authzdb:1.0 (parse_skel_failed)
parse can not process entire input
Lens: /usr/share/augeas/lenses/storageauthzdb.aug:34.12-.75:
---> Though when the file exists before augtool is used, everything seems to work.
[root ~]# echo version 2.1 >/etc/grid-security/storage-authzdb
[root ~]# augtool
augtool> ls /files/etc/grid-security/storage-authzdb
version = 2.1
augtool> dump-xml /files/etc/grid-security/storage-authzdb
<augeas match="/files/etc/grid-security/storage-authzdb">
<node label="storage-authzdb" path="/files/etc/grid-security/storage-authzdb">
<node label="version">
<value>2.1</value>
</node>
</node>
</augeas>
augtool> set /files/etc/grid-security/storage-authzdb/version "2.2"
augtool> save
Saved 1 file(s)
[root ~]# cat /etc/grid-security/storage-authzdb
version 2.2
What am I doing wrong here?
Thank you for your time,
Xavier.
****
Karlsruher Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)
B. Sc. Xavier Mol
GridKa Storage Administrator and Support Manager
Hermann-von-Helmholtz-Platz 1
Geb. 449
76344 Eggenstein-Leopoldshafen
Phone: +49 721 608 23041
Email: xavier.mol at kit.edu
www.kit.edu
KIT - University of the State of Baden-Württemberg and National Large-scale Research Center of the Helmholtz Association
"Since 2010, the KIT has been certified as a family-friendly university."
****
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_storageauthzdb.aug
Type: application/octet-stream
Size: 1630 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151217/1afc7c53/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: storageauthzdb.aug
Type: application/octet-stream
Size: 1073 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151217/1afc7c53/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6401 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20151217/1afc7c53/attachment.p7s>
More information about the augeas-devel
mailing list