[augeas-devel] set for multiple entries?

Frederik Wagner fnerdwq at googlemail.com
Thu Jun 3 20:19:02 UTC 2010


Hi David,

On Tue, Mar 16, 2010 at 2:40 AM, David Lutterkort <lutter at redhat.com> wrote:
> On Sun, 2010-03-14 at 10:48 +0100, Frederik Wagner wrote:
>> On Fri, Feb 26, 2010 at 12:43 AM, David Lutterkort <lutter at redhat.com> wrote:
>> > On Thu, 2010-02-25 at 19:19 +0100, Frederik Wagner wrote:
...
>
> What's missing is exposing this call in augtool and the language
> bindings - for puppet, that would mean to enhance ruby-augeas.
>
>> The way to do this - as far as I understand - would be to somehow
>> delete the last node in the path/pattern (the node which value hast to
>> be set), match for the resulting patj and do a set on each match+node
>> to set.  But for this I'm lost in the code, I don't want to introduce
>> arbitrary string manipulation in augeas.c ;-)
>> I'm anyway not sure, if the result would allow for all matching
>> operation, e.g. matches on the last part of the path, like
>> "/file/some/path/*[somematch]"
>
> I agree with your analysis - and that it would be way too complicated to
> get right in a language binding.
>
>> Including this in ruby or the ruby API seems more simple, but since I
>> would like to use it in puppet, I don't want to make a change in all
>> the interfaces for a 'dirty hack'.
>
> Let me know how much you can do with this patch. Would be great if you
> could enhance it with a test or two, either by exposing it in augtool
> and writing a shell script that tests it, or with a test written in C.
> Once we have that, I'll commit all that.

finally I managed to include your patch. It seems to work fine. I
exposed the setm call to augtool and included two tests through
augtool. Find the two patches attached (to be applied on top of
yours).

I also exposed the call through the ruby API. This patch is also
attached, including some tests.

I hope this is how you want them. Only thing missing for me is the
inclusion into the puppet provider (also the enhanced set function for
arrays in the ruby API)... so another TODO...

Bye Frederik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Exposed-aug_setm-to-augtool.patch
Type: text/x-patch
Size: 2076 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20100603/c36c1c5c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Tests-for-new-aug_setm-function.patch
Type: text/x-patch
Size: 3134 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20100603/c36c1c5c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Exposed-setm-function-in-ruby-API.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20100603/c36c1c5c/attachment-0002.bin>


More information about the augeas-devel mailing list