Skip to content

Commit

Permalink
Merge pull request sous-chefs#183 from shortdudey123/add_needed_gem_r…
Browse files Browse the repository at this point in the history
…equire

Add require 'aws-sdk' as needed
  • Loading branch information
tas50 committed Jan 19, 2016
2 parents daaa61c + dfbe1ea commit 7d61a16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def find_snapshot_id(volume_id = '', find_most_recent = false)
end

def ec2
begin
require 'aws-sdk'
rescue LoadError
Chef::Log.error("Missing gem 'aws-sdk'. Use the default aws recipe to install it first.")
end

@@ec2 ||= create_aws_interface(::Aws::EC2::Client)
end

Expand Down
5 changes: 5 additions & 0 deletions libraries/elb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ module Elb
include Opscode::Aws::Ec2

def elb
begin
require 'aws-sdk'
rescue LoadError
Chef::Log.error("Missing gem 'aws-sdk'. Use the default aws recipe to install it first.")
end
@@elb ||= create_aws_interface(::Aws::ElasticLoadBalancing::Client)
end
end
Expand Down
5 changes: 5 additions & 0 deletions libraries/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ module S3
include Opscode::Aws::Ec2

def s3
begin
require 'aws-sdk'
rescue LoadError
Chef::Log.error("Missing gem 'aws-sdk'. Use the default aws recipe to install it first.")
end
@@s3 ||= create_aws_interface(::Aws::S3::Client)
end
end
Expand Down

0 comments on commit 7d61a16

Please sign in to comment.