Sha256: aa597daefd06b8ad27734bdf1c5e573f51199352fb40fa42dc2c87e7dfa6aa74

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 Bytes

Contents

#require "fog"

require "log4r"
require "mos-sdk"
include MOS

module VagrantPlugins
  module MOS
    module Action
      # This action connects to MOS, verifies credentials work, and
      # puts the MOS connection object into the `:mos_compute` key
      # in the environment.
      class ConnectMOS
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant_mos::action::connect_mos")
        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)

          @logger.info("Connecting to MOS...")
          #env[:mos_compute] = Fog::Compute.new(fog_config)
          env[:mos_compute] = Client.new(region_config.access_key_id, region_config.secret_access_key, region_config.secret_access_url)

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-mos-0.8.56 lib/vagrant-mos/action/connect_mos.rb