Sha256: fb97ccc4056ee2a138a3ca656389d80d70e0ce18ee9f7ccb7430c753f621f6bb

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

require 'chef/handler'
require 'etcd'
require 'json'

class Chef
  class Handler
    class EtcdReport < Chef::Handler

      attr_reader :etcd

      def initialize(options={})
        @etcd = ::Etcd.client(options)
      end

      def report
        if success?
          data = {total: all_resources.size, updated: updated_resources.size, time: elapsed_time}
          @etcd.set('/nodes/'+Chef::Config[:node_name]+'/chef/report',JSON.dump(data)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chef-etcd-0.0.1 lib/chef/handler/etcd_report.rb