# File lib/cft/puppet.rb, line 6
    def self.genstate(fname)
        result = Puppet::TransBucket.new
        Cft::Puppet::Digest::digesters.select { |dig|
            unless dig.type.respond_to?(:instances)
                $stderr.puts "Warning: type #{dig.type.name} can not be listed, ignoring"
                next false
            end
            dig.preserve?
        }.each { |dig|
            type = dig.type
            bucket = Puppet::TransBucket.new
            bucket.keyword = "class"
            bucket.type = type.name
            type.instances.each do |elt|
                bucket.push(elt.to_trans)
            end
            result.push(bucket)
        }
        File::open(fname, "w") do |f|
            f.write(YAML::dump(result))
        end
        return result
    end