Class: Chef::Knife::BastionStop

Inherits:
BastionBase show all
Includes:
Mixin::ShellOut
Defined in:
lib/chef/knife/bastion_stop.rb

Instance Method Summary collapse

Methods inherited from BastionBase

#initialize_params, #print_tunnel_info, #tunnel_pid

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/chef/knife/bastion_stop.rb', line 11

def run
  initialize_params

  # Retrieve proxy process PID. Raises an error if something is wrong
  pid = tunnel_pid(@local_port)

  shell_out!("kill -9 '#{pid}'")

  ui.info ui.color("OK:  ", :green) + "Tunnel closed, you're safe now"
end