Class: VagrantPlugins::Rackspace::Action::ConnectRackspace
- Inherits:
-
Object
- Object
- VagrantPlugins::Rackspace::Action::ConnectRackspace
- Defined in:
- lib/vagrant-rackspace/action/connect_rackspace.rb
Overview
This action connects to Rackspace, verifies credentials work, and puts the Rackspace connection object into the ‘:rackspace_compute` key in the environment.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ConnectRackspace
constructor
A new instance of ConnectRackspace.
Constructor Details
#initialize(app, env) ⇒ ConnectRackspace
Returns a new instance of ConnectRackspace.
11 12 13 14 |
# File 'lib/vagrant-rackspace/action/connect_rackspace.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_rackspace::action::connect_rackspace") end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant-rackspace/action/connect_rackspace.rb', line 16 def call(env) # Get the configs config = env[:machine].provider_config api_key = config.api_key username = config.username params = { :provider => :rackspace, :version => :v2, :rackspace_api_key => api_key, :rackspace_username => username, :rackspace_auth_url => config.rackspace_auth_url } if config.rackspace_compute_url @logger.info("Connecting to Rackspace compute_url...") params[:rackspace_compute_url] = config.rackspace_compute_url else @logger.info("Connecting to Rackspace region...") params[:rackspace_region] = config.rackspace_region end env[:rackspace_compute] = Fog::Compute.new params @app.call(env) end |