Class: VagrantPlugins::DelphixEngine::Action::DisableEnvironment
- Inherits:
-
Object
- Object
- VagrantPlugins::DelphixEngine::Action::DisableEnvironment
- Includes:
- Util
- Defined in:
- lib/vagrant-delphix/action/disable_environment.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ DisableEnvironment
constructor
A new instance of DisableEnvironment.
Methods included from Util
Constructor Details
#initialize(app, env) ⇒ DisableEnvironment
Returns a new instance of DisableEnvironment.
12 13 14 15 16 17 18 19 20 |
# File 'lib/vagrant-delphix/action/disable_environment.rb', line 12 def initialize(app, env) @app = app @machine = env[:machine] @global_env = @machine.env @provider = @machine.provider_name @logger = Log4r::Logger.new('vagrant::delphix_engine::create_environment') @config = get_config(@machine) end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-delphix/action/disable_environment.rb', line 22 def call(env) # skip if plugin is not active on destroy action return @app.call(env) if !@config.enabled # set the DE url Delphix.url = @config.engine_url Delphix.debug = @config.trace # authenticate the connection Delphix.authenticate!(@config.engine_user,@config.engine_password) # lookup the environment environment = Delphix::Environment.list.lookup_by_name @config.env_name # Disable the environment and all its sources. Blocks until completion or error. environment.disable.wait_for_completion if environment != nil @app.call(env) end |