Class: VagrantPlugins::Skytap::Action::FetchEnvironment
- Defined in:
- lib/vagrant-skytap/action/fetch_environment.rb
Overview
Fetches the environment from the environment URL file, assuming the file exists and the corresponding Skytap environment does too.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ FetchEnvironment
constructor
A new instance of FetchEnvironment.
Constructor Details
#initialize(app, env) ⇒ FetchEnvironment
Returns a new instance of FetchEnvironment.
11 12 13 14 |
# File 'lib/vagrant-skytap/action/fetch_environment.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_skytap::action::fetch_environment") end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-skytap/action/fetch_environment.rb', line 16 def call(env) unless env[:environment] if props = API::Environment.properties(env) begin env[:environment] = API::Environment.fetch(env, props['url']) rescue Errors::DoesNotExist => ex @logger.info("Ignoring missing environment '#{props['url']}'.") end end end @app.call(env) end |