Sha256: edef44b239a998bef5d3adfd0f6c6896e5d12d9631b2498d21913aeab44def34

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

module Percheron
  module Actions
    class Restart
      include Base

      def initialize(unit)
        @unit = unit
      end

      def execute!
        results = []
        results << stop!
        results << start!
        results.compact.empty? ? nil : unit
      end

      private

        attr_reader :unit

        def stop!
          Stop.new(unit).execute!
        end

        def start!
          opts = { needed_units: unit.startable_needed_units.values }
          Start.new(unit, opts).execute!
        end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
percheron-0.8.1 lib/percheron/actions/restart.rb
percheron-0.8.0 lib/percheron/actions/restart.rb