Sha256: 5b3247a9215777f88e12e832a3d9caa9876f1bdc8a3f63ed6cd189df13db7367
Contents?: true
Size: 968 Bytes
Versions: 18
Compression:
Stored size: 968 Bytes
Contents
require_relative "base" require_relative "../errors" module Kitchen class LifecycleHook class Remote < Base # Execute a specific remote command hook. # # @return [void] 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 begin conn = instance.transport.connection(state_file.read) conn.execute(command) rescue Kitchen::Transport::SshFailed => e return if hook[:skippable] && e.message.match(/^SSH exited \(\d{1,3}\) for command: \[.+\]$/) raise end end private # return [String] def command hook.fetch(:remote) end end end end
Version data entries
18 entries across 18 versions & 2 rubygems