Issue #2823 has been updated by Peter Valdemar Mørch.
I propose to re-open this issue, as the original title still describes a true
situation, reproduced here more simply:
This is weird.pp
file { '/tmp/nonexist2':
recurse => true,
# dir does not exist
source => '/tmp/nonexist1',
}
Running it:
> puppet apply weird.pp
err: /Stage[main]//File[/tmp/nonexist2]: Failed to generate additional
resources using 'eval_generate': undefined method `relative_path' for
nil:NilClass
err: /Stage[main]//File[/tmp/nonexist2]: Could not evaluate: Could not
retrieve information from source(s) /tmp/nonexist1 at
/home/pvm/git/capmon/test/weird.pp:5
The first error is not useful to the user at least.
----------------------------------------
Bug #2823: fail and unhelpful error message if a remote directory doesn't exist.
https://projects.puppetlabs.com/issues/2823#change-56060
Author: Peter Meier
Status: Rejected
Priority: Normal
Assignee: Dan Bode
Category: file
Target version: 0.25.2
Affected Puppet version: 0.25.1
Keywords:
Branch:
Given the following define
<pre>
define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
{
$dir = "/var/lib/puppet/modules/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
"/var/lib/puppet/modules/${name}":
source => [ "puppet://$server/modules/${name}/modules_dir",
"puppet://$server//modules/common/empty"],
checksum => mtime,
# ignore the placeholder
ignore => '\.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group;
}
}
}
</pre>
and the following call:
<pre>
modules_dir { ["munin", "munin/nodes", "munin/plugins" ]: }
</pre>
As @$modules/munin/files/nodes/modules_dir@ doesn't exist, it should take the
second fallback and more generic one @$modules/common/files/empty@ which exists.
However the resource fails completely with the following 2 rather cryptic error
messages:
<pre>
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:588:in `recurse_remote'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:587:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:587:in `recurse_remote'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:483:in `recurse'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:385:in `eval_generate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:347:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:347:in
`generate_additional_resources'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:191:in `eval_generate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:238:in
`eval_children_and_apply_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:205:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:294:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:416:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:293:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:287:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:287:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:153:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:176:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:152:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/1.8/sync.rb:229:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:130:in `with_client'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
err: //Modules_dir[virtual]/File[/var/lib/puppet/modules/virtual]: Failed to
generate additional resources using 'eval_generate'
: undefined method `relative_path' for nil:NilClass
/usr/lib/ruby/site_ruby/1.8/puppet/parameter.rb:401:in `fail'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file/source.rb:160:in `init_metadata'
/usr/lib/ruby/site_ruby/1.8/puppet/util/cacher.rb:106:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/util/cacher.rb:106:in `cached_value'
/usr/lib/ruby/site_ruby/1.8/puppet/util/cacher.rb:46:in `metadata'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file/source.rb:115:in
`copy_source_values'
/usr/lib/ruby/site_ruby/1.8/puppet/type/file.rb:638:in `retrieve'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:726:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:60:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:249:in
`eval_children_and_apply_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:416:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:248:in
`eval_children_and_apply_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:205:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:294:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:416:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:293:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:287:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:287:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:153:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:176:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:152:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/1.8/sync.rb:229:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:130:in `with_client'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/sbin/puppetd:159
err: //Modules_dir[virtual]/File[/var/lib/puppet/modules/virtual]: Failed to
retrieve current state of resource: Could not retrieve information from
source(s) puppet:///modules/virtual/modules_dir,
puppet:////modules/common/empty at
/srv/puppet/development/modules/public/common/manifests/defines/modules_dir.pp:25
</pre>
a) it shouldn't fail completely
b) the error message isn't that helpfull (eval_generate on Nil:Class), but this
might be not an issue anymore if the failing is fixed.
tested using latest 0.25.x head.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.