# File lib/puppet/util/filetype.rb, line 235 235: def write(text) 236: puts text 237: require "tempfile" 238: output_file = Tempfile.new("puppet") 239: fh = output_file.open 240: fh.print text 241: fh.close 242: 243: # We have to chown the stupid file to the user. 244: File.chown(Puppet::Util.uid(@path), nil, output_file.path) 245: 246: begin 247: Puppet::Util.execute(["crontab", output_file.path], :uid => @path) 248: rescue => detail 249: raise Puppet::Error, "Could not write crontab for %s: %s" % [@path, detail] 250: end 251: output_file.delete 252: end