[augeas-devel] Re: [Augeas] #23: Incorrect value returned by aug_get
Augeas
trac at fedorahosted.org
Mon Dec 8 12:50:20 UTC 2008
#23: Incorrect value returned by aug_get
---------------------+------------------------------------------------------
Reporter: lutter | Owner: lutter
Type: defect | Status: new
Priority: major | Milestone: next
Component: Augeas | Version: 0.3.1
Resolution: | Keywords:
---------------------+------------------------------------------------------
Comment (by ddumont):
Hello
In fact, a similar issue (but not exactly the same) arise also for lenses
like sshd !HostKey. To add a new element to !HostKey, the user must know
that /files/etc/ssh/sshd_config/HostKey![4] is correct, but
/files/etc/ssh/sshd_config/HostKey/4 is not.
Likewise, the issue arise for hash like lenses like sshd Subsystem. To add
a new subsystem the user must enter something like
/files/etc/ssh/sshd_config/Subsystem![4]/bazftp.
/files/etc/ssh/sshd_config/Subsystem/bazftp will not be accepted.
To make matter more confusing for the user, to remove a subsystem, one
must remove the correct node. I.e.
aug_rm(/files/etc/ssh/sshd_config/Subsystem![4]/bazftp) will fail when
saving the file. The user must do
aug_rm(/files/etc/ssh/sshd_config/Subsystem![4]) to be able to save the
modified file.
I've detailed all these issues in the documentation of the "bridge"
between Augeas and Config::Model in [http://config-
model.svn.sourceforge.net/viewvc/config-model/trunk/config-model-backend-
augeas/lib/Config/Model/Backend/Augeas.pm?revision=812&view=markup
"bridge" source] (at line 106). I'll give a URL to formatted doc once
Config::Model::Backend::Augeas is released in CPAN.
For what it's worth, I've implemented a way to work around the issue
mentioned above so that the end user does not have to worry about whether
a lenses needs an index between square brackets or not. Removal of nodes
is also taken care of. This work-around relies on the specification of
what I called "sequential lens" (see doc above). You can probably re-use
some of the ideas of this work-around.
Feel free to come back to me if you need more explanations.
All the best
--
Ticket URL: <https://fedorahosted.org/augeas/ticket/23#comment:1>
Augeas <http://augeas.net/>
a configuration API
More information about the augeas-devel
mailing list