| Nicholas Fagerlund this is incorrect. Both functions (file() and template()) have not been changed according to git history. The original idea is to have the template() function also accept an array like the source parameter does. The first existing file in the array would then be used as template file. Right now, concatenation of multiple templates into one by providing multiple template files separated by commas still work. The proposed change has not been applied. Example: module dir
. |
└── test |
├── files |
│ ├── foobar |
│ └── foobaz |
├── manifests |
│ └── init.pp |
└── templates |
├── foobar.erb |
└── foobaz.erb |
init.pp
class test { |
file { '/tmp/woking_template': |
ensure => file, |
content => template('test/foobar.erb', 'test/foobaz.erb'); |
} |
|
file { '/tmp/not_working_template': |
ensure => file, |
content => template(["test/barfoo.erb", "test/foobar.erb"]); |
|
} |
|
file { '/tmp/working_file': |
ensure => file, |
source => ["puppet:///modules/test/barfoo", "puppet:///modules/test/foobar"]; |
} |
} |
Result:
/tmp/woking_template: |
concatenated output of foobar.erb and foobaz.erb |
/tmp/not_working_template |
Error: Evaluation Error: Error while evaluating a Function Call, undefined method `split' for ["test/foobar.erb", "test/barfoo.erb"]:Array (file: /home/rob/puppet/test/manifests/init.pp, line: 9, column: 16) on node rreus.localdomain |
/tmp/working_file: |
content of modules/test/foobar as modules/test/barfoo does not exist |
Expected result: Contents of '/tmp/not_working_template' should be whatever is in test/templates/foobar.erb since test/templates/barfoo.erb does not exist. This works for the source parameter but not for the template() function. Can someone look into this again? If it is feasible, we can include the function originally created by R.I.Pienaar and made into a module by Dean Wilson into upstream, or merge the multitemplate and template functions together. I do not see a use-case for concatenation of multiple template files into one so would gladly see that one make place for the proposed change. |