Class: VagrantPlugins::SshConfigManager::Action::Halt

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_ssh_config_manager/action/halt.rb

Overview

Handles SSH config update when a Vagrant machine is halted or suspended

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Halt

Returns a new instance of Halt.



8
9
10
11
12
# File 'lib/vagrant_ssh_config_manager/action/halt.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant_ssh_config_manager/action/halt.rb', line 14

def call(env)
  machine = env[:machine]

  # Handle SSH config for halt/suspend operations
  if machine
    config = machine.config.sshconfigmanager
    handle_ssh_config_for_halt(machine, config, env) if config&.enabled && config.keep_config_on_halt
  end

  # Call the next middleware (actual halt/suspend)
  @app.call(env)
end