# File lib/smart_proxy_abrt/abrt_lib.rb, line 163
    def self.save(host, report, reported_at=nil)
      # create the spool dir if it does not exist
      FileUtils.mkdir_p HostReport.spooldir

      reported_at ||= Time.now.utc
      on_disk_report = { "host" => host, "report" => report , "reported_at" => reported_at.to_s }

      # write report to temporary file
      temp_fname = unique_filename "new-"
      File.open temp_fname, File::WRONLY|File::CREAT|File::EXCL do |tmpfile|
        tmpfile.write(on_disk_report.to_json)
      end

      # rename it
      final_fname = unique_filename("ureport-" + DateTime.now.iso8601 + "-")
      File.link temp_fname, final_fname
      File.unlink temp_fname
    end