Skip to content

Commit 5ad49eb

Browse files
Alex DacreHelen Campbell
Alex Dacre
authored and
Helen Campbell
committed
Fix issue where the following causes obscure catalog compilation errors:
``` file { '/tmp/somefile': ensure => 'file', } File['/tmp/somefile'] -> Package <| |> ensure_packages($somearray) ``` If $somearray is undefined or one of the elements contains an empty string, an error like the following is thrown: Could not find resource 'Package[]' for relationship from 'File[/tmp/somefile]' on node $::fqdn
1 parent 419ffeb commit 5ad49eb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/puppet/parser/functions/ensure_packages.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module Puppet::Parser::Functions
3636

3737
Puppet::Parser::Functions.function(:ensure_resource)
3838
packages.each { |package_name|
39+
raise(Puppet::ParseError, 'ensure_packages(): Empty String provided for package name') if package_name.length == 0
3940
if !findresource("Package[#{package_name}]")
4041
function_ensure_resource(['package', package_name, defaults ])
4142
end

0 commit comments

Comments
 (0)