Ask Your Question

stdlib function, strftime("%A") conflicts with data source double quoted string.

asked 2018-07-23 16:35:43 -0600

robinhood gravatar image

updated 2018-07-24 08:03:41 -0600

DarylW gravatar image

nested interpolation in yaml file being used in hiera

The hiera data source .../hieradata/somefile.yaml, requires double quotes around the string to interpolate everything that's inside of it -- like the \n newlines and the aforementioned function. The function itself also requires double quotes inside of it. I also can't seem to get a heredoc to work inside this yaml data source file.

This is in a yaml file that is being used by hiera as a data source. 

motd::message: "This is my rep node203centos7 node.\nThis is also my puppet practice host.\nThis message is resolving from ...environments/hieradata/nodes/facts.networking.hostname.\nThe datadir is global to all environments, but the message is specific to this host.\nToday is strftime("%A")."

I'm just trying to get the day to automatically populate in the string.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-07-24 12:15:46 -0600

binford2k gravatar image

Is that really a good idea? If that worked, it would mean that the file resource will change every single day, meaning that you'll get change reports even when the change means nothing. And then seeing actual changes becomes harder to see in the noise.

In any case, Hiera functions don't work as flexibly as Puppet functions do. YAML isn't a programming language, it's data storage. See for more information.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-07-23 16:35:43 -0600

Seen: 68 times

Last updated: Jul 24