summaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorAlex Dacre <alex.dacre@cirrus.com>2017-04-26 12:47:29 +0100
committerHelen Campbell <helen@puppetlabs.com>2017-05-09 13:16:08 +0100
commit5ad49ebaecbdbc6faa58282c45aad1c46d4d7f2c (patch)
tree1788020ff56acfaa72c978df184f31c60ccc1805 /lib/puppet/parser
parent419ffeb1d167a05af6858e2e4749f6414532f5d2 (diff)
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
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/ensure_packages.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/ensure_packages.rb b/lib/puppet/parser/functions/ensure_packages.rb
index 17942b8..034f997 100644
--- a/lib/puppet/parser/functions/ensure_packages.rb
+++ b/lib/puppet/parser/functions/ensure_packages.rb
@@ -36,6 +36,7 @@ third argument to the ensure_resource() function.
Puppet::Parser::Functions.function(:ensure_resource)
packages.each { |package_name|
+ raise(Puppet::ParseError, 'ensure_packages(): Empty String provided for package name') if package_name.length == 0
if !findresource("Package[#{package_name}]")
function_ensure_resource(['package', package_name, defaults ])
end