Sha256: 9a2ccbfb73809388cc2ec6ddabde96100d23fe94b188b0824e0def1595b8ca34
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'capistrano/configuration' module Capistrano module ForemanExport module Backend class Supervisord def initialize(task) @task = task end def name "supervisord" end def app_name @task.fetch(:foreman_app) end def start_cmd add_or_update_app @task.execute(:sudo, "supervisorctl start #{app_name}:*") end def stop_cmd @task.execute(:sudo, "supervisorctl stop #{app_name}:*") end def restart_cmd add_or_update_app @task.execute(:sudo, "supervisorctl restart #{app_name}:*") end def add_or_update_app status = supervisord_reread if status.include?("#{app_name}:") if status.include?('changed') @task.info("Configration changed, update it.") @task.execute(:sudo, "supervisorctl update #{app_name}") elsif status.include?('available') @task.info("Configration available, add it.") @task.execute(:sudo, "supervisorctl add #{app_name}") end end end def supervisord_reread @task.capture(:sudo, %{supervisorctl reread}) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-foreman_export-0.0.4 | lib/capistrano/foreman_export/backend/supervisord.rb |