Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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. –  m0dlx 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! –  m0dlx 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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