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.

raphink
  • 11,987
  • 6
  • 37
  • 48
Tim Brigham
  • 15,545
  • 10
  • 75
  • 115

1 Answers1

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.

raphink
  • 11,987
  • 6
  • 37
  • 48
  • The only other suggestion I have is to use [augeasfacter](http://forge.puppetlabs.com/camptocamp/augeasfacter) to get the current info in `title[1]` and then use the facts in the Augeas resource. – Dominic Cleal Mar 05 '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. – raphink Mar 06 '13 at 14:14
  • @Raphink, well, just a lot more cumbersome! – Dominic Cleal Mar 06 '13 at 17:27
  • We really have to (find someone willing to) code this `cp` functionality! – raphink Mar 06 '13 at 21:34
  • For the record, the `cp` functionality is now available in HEAD (https://github.com/hercules-team/augeas/commit/6de612927a7635e7b77c028badc26f391875d7f3) and will be released in the next version of Augeas! – raphink Sep 10 '13 at 08:25
  • For the record, it has been made available in augeas, but not yet in puppet. :-( [link to docs](http://docs.puppetlabs.com/puppet/latest/reference/type.html#augeas-attribute-changes) – Peter V. Mørch Feb 04 '16 at 18:36