Class: Kitchen::LifecycleHook::Remote

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/lifecycle_hook/remote.rb

Instance Attribute Summary

Attributes inherited from Base

#hook, #lifecycle_hooks, #phase

Instance Method Summary collapse

Methods inherited from Base

#initialize, #logger, #should_run?

Constructor Details

This class inherits a constructor from Kitchen::LifecycleHook::Base

Instance Method Details

#runvoid

This method returns an undefined value.

Execute a specific remote command hook.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kitchen/lifecycle_hook/remote.rb', line 10

def run
  # Check if we're in a state that makes sense to even try.
  unless instance.last_action
    if hook[:skippable]
      # Just not even trying.
      return
    else
      raise UserError, "Cannot use remote lifecycle hooks during phases when the instance is not available"
    end
  end

  conn = instance.transport.connection(state_file.read)
  conn.execute(command)
end