Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ec2 hints recipe #89

Merged
merged 1 commit into from
Oct 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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! }