Nico De Ranter
2008-Jan-22 15:48 UTC
Could not set file on ensure: undefined method `[]'' for nil:NilClass
Hi,
I had a working puppet setup using version 0.22 until the ruby security
patch bit me. I tried upgrading server and clients to 0.24.1 however my
old manifests don''t seem to work anymore. When I run puppetd on the
client I see lots of messages like:
err:
//Node[waterbuck]/yumupdater/Remotefile[/etc/cron.hourly/yumupdater]/File[/etc/cron.hourly/yumupdater]/ensure:
change from absent to file failed: Could not set file on ensure: undefined
method `[]'' for nil:NilClass at
/raid/puppet/manifests/definitions/remotefile.pp:15
The remotefile.pp looks ok to me:
----------- remotefile .pp
$server = "puppet"
# The same as a file, except that the source is always taken
# relative to the /config module on the file server
define remotefile($owner = root, $group = root, $mode = 644, $source,
$backup = false, $recurse = false, $ensure = file) {
file { $name:
mode => $mode,
owner => $owner,
group => $group,
backup => $backup,
recurse => $recurse,
ensure => $ensure,
source => "puppet://$server/files/$source"
}
}
--------------------
It''s used in:
--------------------
class yumupdater {
remotefile { "/etc/cron.hourly/yumupdater":
source =>
"os/$operatingsystem/$lsbdistrelease/etc/cron.hourly/yumupdater",
ensure => file,
mode => 755 }
}
---------------------
Any idea what I''m doing wrong?
Thanks in advance,
Nico
Jean-Baptiste Quenot
2008-Jan-23 11:37 UTC
Re: Could not set file on ensure: undefined method `[]'' for nil:NilClass
This is a known bug, have a look at the bug report: Undefined method error in pfile/source.rb when source for file resource does not exist http://reductivelabs.com/trac/puppet/ticket/1008 Cheers, -- Jean-Baptiste Quenot http://caraldi.com/jbq/blog/
Luke Kanies
2008-Jan-29 04:04 UTC
Re: Could not set file on ensure: undefined method `[]'' for nil:NilClass
On Jan 23, 2008, at 2:48 AM, Nico De Ranter wrote:> Hi, > > I had a working puppet setup using version 0.22 until the ruby > security > patch bit me. I tried upgrading server and clients to 0.24.1 > however my > old manifests don''t seem to work anymore. When I run puppetd on the > client I see lots of messages like: > > err: //Node[waterbuck]/yumupdater/Remotefile[/etc/cron.hourly/ > yumupdater]/File[/etc/cron.hourly/yumupdater]/ensure: change from > absent to file failed: Could not set file on ensure: undefined > method `[]'' for nil:NilClass at /raid/puppet/manifests/definitions/ > remotefile.pp:15Sorry for the slow response; can you send a stack trace for this? -- A censor is a man who knows more than he thinks you ought to. -- Granville Hicks --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com