Skip to content

Commit

Permalink
Add ec2 hints recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
cwebberOps committed Oct 22, 2014
1 parent 469416c commit a95e710
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ from this cookbook are used.
The `gem_package` is created as a Ruby Object and thus installed
during the Compile Phase of the Chef run.

ec2_hints.rb
------------

This recipe is used to setup the ec2 hints for ohai in the case that an
instance is not created using knife-ec2.

Libraries
=========

Expand Down
13 changes: 13 additions & 0 deletions recipes/ec2_hints.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
directory '/etc/chef/ohai/hints' do
recursive true
action :create
end.run_action(:create)

file '/etc/chef/ohai/hints/ec2.json' do
content {}
action :create
end.run_action(:create)

ohai 'reload' do
action :reload
end.run_action(:reload)
17 changes: 17 additions & 0 deletions spec/ec2_hints_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe 'aws::ec2_hints' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }

it 'sets up the directory' do
expect(chef_run).to create_directory('/etc/chef/ohai/hints').at_compile_time
end

it 'adds the hint file' do
expect(chef_run).to create_file('/etc/chef/ohai/hints/ec2.json').at_compile_time
end

it 'reloads ohai' do
expect(chef_run).to reload_ohai('reload')
end
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'chefspec'
require 'chefspec/berkshelf'

at_exit { ChefSpec::Coverage.report! }

0 comments on commit a95e710

Please sign in to comment.