1

Is there a ready way to copy a branch natively in augeas or via the puppet augeas handler?

If the copy operator were natively available in augeas it would be something like

cp /files/etc/grub.conf/title[1]/ /files/etc/grub.conf/title[99]/

In my case this is a 'title[x]' section in grub.conf but I'm sure the same thing is applicable elsewhere.

1 Answer 1

1

This is a feature that has been planned for a looooon time. In fact, it's ticket #2, which is still open.

So the answer is no, there's currently no cp operator in the API. You could probably emulate it in the language of your choice if you don't want to contribute it, by recursively traversing the nodes and creating them in the destination tree.

6
  • The only other suggestion I have is to use augeasfacter to get the current info in title[1] and then use the facts in the Augeas resource. Mar 5, 2013 at 18:54
  • @m0dlx: if it's a single value, sure, but if it's a full tree (as is the case with Grub's titles), that won't work.
    – raphink
    Mar 6, 2013 at 14:14
  • @Raphink, well, just a lot more cumbersome! Mar 6, 2013 at 17:27
  • We really have to (find someone willing to) code this cp functionality!
    – raphink
    Mar 6, 2013 at 21:34
  • For the record, the cp functionality is now available in HEAD (github.com/hercules-team/augeas/commit/…) and will be released in the next version of Augeas!
    – raphink
    Sep 10, 2013 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .