Sha256: 9f213452d436a25edb08f300f5375771ba8da74b5118e2fc8b86b1b7fba151d2

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

require "fog"
require "log4r"

module VagrantPlugins
  module OpenStack
    module Action
      # This action connects to OpenStack, verifies credentials work, and
      # puts the OpenStack connection object into the `:openstack_compute` key
      # in the environment.
      class ConnectOpenStack
        def initialize(app, env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_openstack::action::connect_openstack")
        end

        def call(env)
          # Get the configs
          config   = env[:machine].provider_config
          @logger.info("Connecting to OpenStack Compute...")
          env[:openstack_compute] = Fog::Compute.new({
                        :provider => :openstack,
                        :openstack_region => config.region,
                        :openstack_username => config.username,
                        :openstack_api_key => config.api_key,
                        :openstack_auth_url => config.endpoint,
                        :openstack_tenant => config.tenant
                    })

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrant-openstack-cloud-provider-1.1.8 lib/vagrant-openstack-cloud-provider/action/connect_openstack.rb
vagrant-openstack-cloud-provider-1.1.6 lib/vagrant-openstack-cloud-provider/action/connect_openstack.rb
vagrant-openstack-cloud-provider-1.1.5 lib/vagrant-openstack-cloud-provider/action/connect_openstack.rb
vagrant-openstack-cloud-provider-1.1.4 lib/vagrant-openstack-cloud-provider/action/connect_openstack.rb
openstack-vagrant-1.1.3 lib/vagrant-openstack/action/connect_openstack.rb
openstack-vagrant-1.1.2 lib/vagrant-openstack/action/connect_openstack.rb