Class: VagrantPlugins::OpenStack::Action::ConnectOpenStack
- Inherits:
-
Object
- Object
- VagrantPlugins::OpenStack::Action::ConnectOpenStack
- Defined in:
- lib/vagrant-openstack/action/connect_openstack.rb
Overview
This action connects to OpenStack, verifies credentials work, and puts the OpenStack connection object into the :openstack_compute key in the environment.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ConnectOpenStack
constructor
A new instance of ConnectOpenStack.
Constructor Details
#initialize(app, env) ⇒ ConnectOpenStack
Returns a new instance of ConnectOpenStack.
11 12 13 14 |
# File 'lib/vagrant-openstack/action/connect_openstack.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_openstack::action::connect_openstack") end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-openstack/action/connect_openstack.rb', line 16 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 |