Sha256: 8b6bb6fc3c554ac938f846f4bd21681151be48736adaf5ce6763106bbdcdadc2
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require "fog" require "log4r" module VagrantPlugins module GQ module Action # This action connects to GQ, verifies credentials work, and # puts the GQ connection object into the `:gq_compute` key # in the environment. class ConnectGQ def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_gq::action::connect_gq") 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) # Build the fog config fog_config = { :provider => :aws, } if region_config.use_iam_profile fog_config[:use_iam_profile] = true else fog_config[:aws_access_key_id] = region_config.access_key_id fog_config[:aws_secret_access_key] = region_config.secret_access_key end fog_config[:endpoint] = "https://api.greenqloud.com/" # fog_config[:endpoint] = region_config.endpoint if region_config.endpoint # fog_config[:version] = region_config.version if region_config.version @logger.info("Connecting to GQ...") env[:gq_compute] = Fog::Compute.new(fog_config) @app.call(env) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-gq-0.1.2 | lib/vagrant-gq/action/connect_gq.rb |
vagrant-gq-0.1.1 | lib/vagrant-gq/action/connect_gq.rb |
vagrant-gq-0.1.0 | lib/vagrant-gq/action/connect_gq.rb |