Class: VagrantPlugins::ChefZero::Action::Stop
- Inherits:
-
Object
- Object
- VagrantPlugins::ChefZero::Action::Stop
- Includes:
- EnvHelpers, ServerHelpers
- Defined in:
- lib/vagrant-chef-zero/action/stop.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Stop
constructor
A new instance of Stop.
Methods included from ServerHelpers
#chef_zero_server_running?, #find_chef_zero_binary, #fork_process, #get_chef_zero_binary, #get_chef_zero_server_pid, #has_chef_zero_binary?, #is_a_chef_zero_server?, #kill_process, #port_open?, #start_chef_zero, #stop_chef_zero, #wait_for_server_to_start
Methods included from EnvHelpers
active_machines, #berkshelf_enabled?, #chef_client?, #chef_zero_enabled?, #get_chef_server_url, #get_fake_key_path, #get_host, #get_key_path, #get_port, #get_validation_client_name, mutex, #provisioners, #rm_knife_config, #server_info, #set_berkshelf_client_key, #set_config, #write_knife_config
Constructor Details
#initialize(app, env) ⇒ Stop
Returns a new instance of Stop.
10 11 12 13 |
# File 'lib/vagrant-chef-zero/action/stop.rb', line 10 def initialize(app, env) @app = app @key = get_key_path(env) end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vagrant-chef-zero/action/stop.rb', line 15 def call(env) unless chef_zero_enabled?(env) return @app.call(env) end EnvHelpers.mutex.synchronize do active = EnvHelpers.active_machines(env) active.delete_if do |name, provider| name == env[:machine].name end unless active.empty? return @app.call(env) end end stop_chef_zero(env) rm_knife_config(env) @app.call(env) end |