Class: VagrantPlugins::SshConfigManager::Action::Destroy

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-ssh-config-manager/action/destroy.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Destroy

Returns a new instance of Destroy.



5
6
7
8
9
# File 'lib/vagrant-ssh-config-manager/action/destroy.rb', line 5

def initialize(app, env)
  @app = app
  @env = env
  @logger = Log4r::Logger.new("vagrant::plugins::ssh_config_manager::action::destroy")
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-ssh-config-manager/action/destroy.rb', line 11

def call(env)
  machine = env[:machine]
  
  # Handle SSH config removal before destroying the machine
  if machine
    config = machine.config.sshconfigmanager
    if config && config.enabled && config.auto_remove_on_destroy
      handle_ssh_config_removal(machine, config)
    end
  end

  # Call the next middleware (actual destroy)
  @app.call(env)
end