Sha256: 6ffd92cc85fb0635c2dcd05c2791eb76c523b0221cec34b4b01feaff4c59b522

Contents?: true

Size: 1.44 KB

Versions: 63

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require 'avm/eac_rails_base1/instances/systemd_unit'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacRailsBase1
    module Instances
      module Runners
        class TasksScheduler
          class SystemdUnit
            DEFAULT_RESTART = 'on-failure'

            runner_with :help do
              desc 'Configure Systemd unit for instace\'s tasks scheduler daemon (Reference: ' \
                'https://www.freedesktop.org/software/systemd/man/systemd.service.html).'
              bool_opt '-e', '--exec-run', 'Run daemon with "run" instead of "start"/"stop".'
              arg_opt '-r', '--restart', 'Value for systemd.service, Restart=.',
                      default: DEFAULT_RESTART
            end

            delegate :restart, to: :parsed

            def run
              if result.error?
                fatal_error result.to_s
              else
                infov 'Result', result.label
              end
            end

            private

            def systemd_unit_uncached
              ::Avm::EacRailsBase1::Instances::SystemdUnit.new(runner_context.call(:instance),
                                                               restart: parsed.restart,
                                                               exec_run: parsed.exec_run?)
            end

            def result_uncached
              systemd_unit.run
            end
          end
        end
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 2 rubygems

Version Path
eac_tools-0.79.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.78.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.77.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.77.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.76.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.76.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.75.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
avm-eac_rails_base1-0.9.3 lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.75.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.75.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
avm-eac_rails_base1-0.9.2 lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.74.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.74.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.73.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.72.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
avm-eac_rails_base1-0.9.1 lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.70.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
avm-eac_rails_base1-0.9.0 lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.70.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
eac_tools-0.69.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb