[augeas-devel] [PATCH] Array handling shellvars_array lens added.
David Lutterkort
lutter at redhat.com
Thu Mar 25 23:45:54 UTC 2010
On Tue, 2010-03-23 at 21:38 +0100, Frederik Wagner wrote:
> Lens shellvars_array has been added to treat variables in specific
> files as array of words, e.g. in /etc/sysconfig/ 'kernel' and
> 'bootloader'.
>
> * lenses/shellvars.aug:
> removed include for /etc/sysconfig/kernel
> * lenses/shellvars_array.aug:
> new lens
> * lenses/tests/test_shellvars_array.aug:
> test for new lens
This doesn't quite do what you want it to do yet. With the
following /etc/sysconfig/kernel:
# UPDATEDEFAULT specifies if new-kernel-pkg should make
# new kernels the default
UPDATEDEFAULT=yes
# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel-xen
I get the following complaint from augtool:
/augeas/files/etc/sysconfig/kernel/error = "parse_failed"
/augeas/files/etc/sysconfig/kernel/error/pos = "82"
/augeas/files/etc/sysconfig/kernel/error/line = "3"
/augeas/files/etc/sysconfig/kernel/error/char = "0"
/augeas/files/etc/sysconfig/kernel/error/lens = "/homes/lutter/code/augeas/lenses/shellvars_array.aug:27.12-.37:"
/augeas/files/etc/sysconfig/kernel/error/message = "Iterated lens matched less than it should"
It seems the lens does not allow entries that are not enclosed in
quotes. Also, how will it handle single-quoted lists, like
VAR='val1 val2 val3'
It might be better to call the construct you are using a list to
distinguish it from the arrays that the shell already supports. But I
generally like the direction this lens is taking.
David
More information about the augeas-devel
mailing list