Created
January 25, 2017 15:00
-
-
Save cabecada/d6940042b1bb9f5ede3df4438f1e65e3 to your computer and use it in GitHub Desktop.
Puppet erb converts int to str in yaml dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@master:/etc/puppet# cat /tmp/modules/foo/templates/foo | |
<%- | |
def yaml_indent(conds) | |
return_val = [] | |
tmp_val = conds.to_yaml.split("\n") | |
tmp_val.delete('---') | |
tmp_val.each do |val| | |
return_val << " " + val | |
end | |
return_val.join("\n") | |
end | |
-%> | |
<%= yaml_indent(@foo) %> | |
root@master:/etc/puppet# cat /tmp/modules/foo/manifests/init.pp | |
class foo { | |
$foo = {"a" => 1, "b" => "he"} | |
file { '/tmp/foo': | |
content => template('foo/foo'), | |
owner => root, | |
group => root, | |
mode => 644, | |
} | |
} | |
root@master:/etc/puppet# puppet apply --modulepath /tmp/modules -e 'include foo' | |
Already evaluated rest at /var/lib/gems/2.0.0/gems/facter-2.4.6/lib/facter/ec2.rb:21, reevaluating anyways | |
Already evaluated rest at /var/lib/gems/2.0.0/gems/facter-2.4.6/lib/facter/ec2.rb:38, reevaluating anyways | |
Already evaluated rest at /var/lib/gems/2.0.0/gems/facter-2.4.6/lib/facter/gce.rb:4, reevaluating anyways | |
Notice: Compiled catalog for master.vagrant.local in environment vagrant in 0.26 seconds | |
Notice: Finished catalog run in 0.01 seconds | |
root@master:/etc/puppet# cat /tmp/foo | |
--- | |
a: "1" | |
b: he |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment