Sha256: 8e7c870ffa7305d0b1298b565e43d810aa5ed9f7fe5b9f5130de78a7eb6b8250

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 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

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

      private

      # return [String]
      def command
        hook.fetch(:remote)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
test-kitchen-2.11.2 lib/kitchen/lifecycle_hook/remote.rb
test-kitchen-2.11.1 lib/kitchen/lifecycle_hook/remote.rb
test-kitchen-2.11.0 lib/kitchen/lifecycle_hook/remote.rb
test-kitchen-2.10.0 lib/kitchen/lifecycle_hook/remote.rb