Sha256: bb0c1faa7792a2bf13e9710dc468ae7611e6e6f852e72ff2992794556d2f82cc
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
module Percheron module Actions class Start include Base def initialize(unit, dependant_units: [], cmd: false, exec_scripts: true) @unit = unit @dependant_units = dependant_units @cmd = cmd @exec_scripts = exec_scripts end def execute! results = [] results << create! unless unit.running? results << start! results << execute_post_start_scripts! end results.compact.empty? ? nil : unit end private attr_reader :unit, :dependant_units, :cmd, :exec_scripts def exec_scripts? !unit.post_start_scripts.empty? && exec_scripts end def create! return nil if unit.exists? Create.new(unit, cmd: cmd, exec_scripts: exec_scripts).execute! end def start! return nil if !unit.startable? || unit.running? $logger.info "Starting '#{unit.display_name}' unit" unit.container.start! end def execute_post_start_scripts! scripts = unit.post_start_scripts Exec.new(unit, dependant_units, scripts, 'POST start').execute! if exec_scripts? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
percheron-0.7.16 | lib/percheron/actions/start.rb |
percheron-0.7.15 | lib/percheron/actions/start.rb |
percheron-0.7.14 | lib/percheron/actions/start.rb |