2

In the process of trying to learn augeas config file language, the first real task I set to was to copy the first block of my grub.conf and add a "single" kernel parameter to the copy.

In doing this, I scoured to the documentation and could not find an expression that allows you get the value of another node in the tree (like a function or operator or something). You know, something like a star (*) in C for indirection so that you can copy a value into another part of the tree.

I'm sure if I was using the C API I would be able to get the value, but I'm looking mostly to call it from puppet, so it's more like using it through augtool.

Am I crazy or is it really part of the language and I just don't see it?

1 Answers1

4

There is currently no way to copy a value of a node to another node using the Augeas language only.

In order to achieve this in Puppet, you need to retrieve the value before the catalog is processed in order to use the value in the catalog. Doing this requires writing a fact.

The easiest way to make a fact based on Augeas is to use augeasfacter which lets you easily create new facts using a simple configuration file.

Once you have created the new fact, you can use its value in Puppet like you would any other variable. In particular, you can use it to set a node using the augeas type.

raphink
  • 3,625
  • 1
  • 28
  • 39