GithubHelp home page GithubHelp logo

chef-handler-s3's Introduction

Description

A Chef Exception & Reporting Handler for storing reports at S3.

The gem install a exception/report handler for Chef that create a local simplified JSON report and then upload it to a S3 bucket.

This Chef Exception & Reporting Handler gem is heavily based on the Campfire's one and the Chef's JsonFile handler.

Usage

  1. Create a Amazon S3 account.
  2. Retrieve your ACCESS_KEY_ID and your SECRET_ACCESS_KEY.
  3. Create a bucket.
  4. Download the chef_handler Cookbook.
  5. Given you've retrieved your S3 ACCESS_KEY_ID as :access_key_id, your SECRET_ACCESS_KEY as :secret_access_key and the bucket name as :bucket_name, add a Recipe similar to the example below:
include_recipe "chef_handler::default"

%w{libxml2-dev libxslt1-dev}.each do |pkg|
  package pkg do
    action :nothing
  end.run_action(:install)
end

chef_gem 'aws-sdk'
chef_gem "chef-handler-s3"
gem "chef-handler-s3"

chef_handler 'Chef::Handler::S3' do
  source 'chef/handler/s3'
  arguments :access_key_id     => 'XXXXXXXXXXXXX',
            :secret_access_key => 'XXXXXXXXXXXXX',
            :bucket_name       => 'some_bucket_name',
            :folder            => 'some_bucket_folder_name'
  action :enable
end

The argument :folder is optional. This will store the file inside of a folder with that name at the pointed bucket.

See also: Enable Chef Handler with LWRP

Authors

  1. Juanje Ojeda

Copyright

Copyright 2012 Wantudu

License

Apache License 2.0

chef-handler-s3's People

Contributors

juanje avatar

Stargazers

 avatar

Watchers

 avatar

chef-handler-s3's Issues

Chef::Handler::S3 raised #<NoMethodError: undefined method `cloud'

Chef-client version

In Work Station - 12.21.2
In client - 13.6.4

Platform Details

client - ubuntu

Scenario

trying to upload a report file to S3.

Steps to Reproduce:

create a cookbook and add the recipe below
[https://github.com/juanje/chef-handler-s3]

Expected Result:

file should be upload to S3

Actual Result:

Running handlers:
[2017-12-20T05:35:47+00:00] ERROR: Report handler Chef::Handler::S3 raised #<NoMethodError: undefined method cloud' for #<Chef::Node::Attribute:0x0000000003bae160>> [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/node.rb:267:in public_send'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/node.rb:267:in method_missing' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-handler-s3-0.1.2/lib/chef/handler/s3.rb:65:in report'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:259:in run_report_unsafe' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:247:in run_report_safely'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:125:in block in run_report_handlers' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:123:in each'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:123:in run_report_handlers' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/handler.rb:135:in block in class:Handler'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/client.rb:443:in block in run_completed_successfully' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/client.rb:442:in each'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/client.rb:442:in run_completed_successfully' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/client.rb:301:in run'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:291:in block in fork_chef_client' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:279:in fork'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:279:in fork_chef_client' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:244:in block in run_chef_client'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/local_mode.rb:44:in with_server_connectivity' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:232:in run_chef_client'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/client.rb:469:in sleep_then_run_chef_client' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/client.rb:458:in block in interval_run_chef_client'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/client.rb:457:in loop' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/client.rb:457:in interval_run_chef_client'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/client.rb:441:in run_application' [2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application.rb:59:in run'
[2017-12-20T05:35:47+00:00] ERROR: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/bin/chef-client:26:in <top (required)>' [2017-12-20T05:35:47+00:00] ERROR: /usr/bin/chef-client:58:in load'
[2017-12-20T05:35:47+00:00] ERROR: /usr/bin/chef-client:58:in `

'

  • Chef::Handler::S3
    Running handlers complete
    Chef Client finished, 0/16 resources updated in 02 seconds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.