Sha256: bbb4c9423e7ee82547d78954b869f2ceb1adc79747542ecae6498ab5ec726d44

Contents?: true

Size: 1.08 KB

Versions: 28

Compression:

Stored size: 1.08 KB

Contents

require 'roo_on_rails/checks/env_specific'
require 'roo_on_rails/checks/papertrail/token'

module RooOnRails
  module Checks
    module Papertrail
      # Check for a configured log destination in Papertrail.
      #
      # Input context
      # - papertrail.client: a connected Papertrail client
      #
      # Output context:
      # - papertrail.dest.host, .port: the destination logging host
      class LogDestinationExists < Base
        requires Token

        # The shared log destination
        NAME = 'default'.freeze

        def intro
          "Checking for log destination #{bold NAME}..."
        end

        def call
          data = context.papertrail.client.list_destinations.find { |h|
            h['syslog']['description'] == NAME
          }

          fail! "Log destination #{bold NAME} not found" if data.nil?

          context.papertrail!.dest!.host = data['syslog']['hostname']
          context.papertrail!.dest!.port = data['syslog']['port']

          pass "logging to #{context.papertrail.dest.host}:#{context.papertrail.dest.port}"
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
roo_on_rails-2.2.2 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.2.1 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.2.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.1.2 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.1.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.0.0.pre.pre.2 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-2.0.0.pre.pre.1 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.22.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.21.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.20.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.19.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.18.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.17.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.16.2 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.16.1 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.16.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.15.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.14.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.13.1 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb
roo_on_rails-1.13.0 lib/roo_on_rails/checks/papertrail/log_destination_exists.rb