Hi,
I have now finished the work on Puppet Heredoc ARM-4.
The proposal is updated and can be read here:
https://github.com/puppetlabs/armatures/blob/master/arm-4.heredoc/heredoc.md
There is now also a full implementation of this available from my branch
here:
https://github.com/hlindberg/puppet/tree/feature/master/heredoc
In short, puppet heredoc allows you to write text blocks in puppet
manifests with control over the left margin and escapes. Here are some
examples:
afunc(@(END))
This is the text that goes into the heredoc
it ends when a line with the end-token is seen.
END
afunc(@(END))
This is the text that goes into the heredoc
it ends when a line with the end-token is seen.
You can control the left margin by using a pipe
on the end line to denote where the margin is.
| END
afunc(@(END/tn))
This turns on escapes for tabs and newlines.
Here is a tab: \t
Here is a newline: \n
END
afunc(@(END:json))
This is supposed to be text in JSON.
If there is a validator for json available
errors will be generated if it is not valid.
END
For further examples and details, see the ARM text. (In the examples
above I am just sending of the value to some function, the @(TAG)
produces a value, so you can use this at any place in the logic where
you can place a string).
You can comment on this ARM here, do a pull request to the armatures
repo, or comment directly on a commit.
If you want to try out the implementation, you need to pull it from my
branch (shown above) and then run with the setting --parser future
Regards
- henrik