Sha256: c3de35b818875f2a61b2615214a411d9b00632664981fbdb0827c9d5707faccd
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require "fog" require "log4r" module VagrantPlugins module AWS module Action # This action connects to AWS, verifies credentials work, and # puts the AWS connection object into the `:aws_compute` key # in the environment. class ConnectAWS def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_aws::action::connect_aws") end def call(env) # Get the region we're going to booting up in region = env[:machine].provider_config.region # Get the configs region_config = env[:machine].provider_config.get_region_config(region) access_key_id = region_config.access_key_id secret_access_key = region_config.secret_access_key @logger.info("Connecting to AWS...") env[:aws_compute] = Fog::Compute.new({ :provider => :aws, :aws_access_key_id => access_key_id, :aws_secret_access_key => secret_access_key, :region => region }) @app.call(env) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-aws-0.1.1 | lib/vagrant-aws/action/connect_aws.rb |
vagrant-aws-0.1.0 | lib/vagrant-aws/action/connect_aws.rb |