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

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.

  • 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. – Dominic Cleal Mar 5 '13 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. – ℝaphink Mar 6 '13 at 14:14
  • @Raphink, well, just a lot more cumbersome! – Dominic Cleal Mar 6 '13 at 17:27
  • We really have to (find someone willing to) code this cp functionality! – ℝaphink Mar 6 '13 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! – ℝaphink Sep 10 '13 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.