Sha256: 3a8e58058abf822915e4217b943a3139458b86aa4d8c1be8cd598448ea1304fd

Contents?: true

Size: 823 Bytes

Versions: 16

Compression:

Stored size: 823 Bytes

Contents

# Capistrano plugin hook to set default values
namespace :load do
  task :defaults do
    set :check_status_roles, fetch(:check_status_roles, [:web])
    set :check_status_path, fetch(:check_status_path, '/status/all')
  end
end

desc 'Run status checks'
task :check_status do
  on roles(fetch(:check_status_roles)), in: :sequence do |host|
    status_url = "https://#{host}#{fetch(:check_status_path)}"

    info "Checking status at #{status_url}"
    status_body = capture("curl #{status_url}")

    if status_body.nil?
      error 'Endpoint could not be reached'
    elsif status_body.match?(/FAILED/)
      error status_body.lines.grep(/FAILED/).join
    elsif !status_body.match?(/PASSED/)
      error status_body
    else
      info SSHKit::Color.new($stdout).colorize('All checks passed!', :green)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dlss-capistrano-5.3.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.2.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.1.1 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.1.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.0.4 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.0.3 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.0.2 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.0.1 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-5.0.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.4.1 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.4.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.3.1 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.3.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.2.1 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.2.0 lib/dlss/capistrano/tasks/check_status.rake
dlss-capistrano-4.1.2 lib/dlss/capistrano/tasks/check_status.rake