Sha256: b55a88410e104f0ac20d9d0d16beb8f3505819347efc6d4ea003fcfae6f96762

Contents?: true

Size: 1.39 KB

Versions: 98

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'avm/entries/jobs/base'
require 'avm/eac_ubuntu_base0/apache'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacRailsBase1
    module Instances
      class SystemdUnit
        JOBS = %w[write_tasks_scheduler_command write_service link_service verify_service
                  reload_systemd enable_service start_service].freeze

        include ::Avm::Entries::Jobs::Base
        require_sub __FILE__, include_modules: true
        delegate :platform_instance, to: :instance

        enable_listable
        lists.add_symbol :option, :exec_run, :restart

        def description
          "#{instance.id} Tasks Scheduler"
        end

        def exec_run?
          options[OPTION_EXEC_RUN]
        end

        def option_list
          self.class.lists.option
        end

        def restart
          options[OPTION_RESTART]
        end

        def unit_name
          "#{instance.id}_tasks_scheduler.service"
        end

        def user
          instance.install_username
        end

        private

        def sudo_execute!(*args)
          platform_instance.host_env.command(['sudo'] + args).execute!
        end

        def sudo_system!(*args)
          command_args = ['sudo'] + args
          infom "Running \"#{::Shellwords.join(command_args)}\"..."
          platform_instance.host_env.command(command_args).system!
        end
      end
    end
  end
end

Version data entries

98 entries across 98 versions & 2 rubygems

Version Path
eac_tools-0.45.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.44.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.43.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.42.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.41.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.40.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.39.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.38.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.37.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.37.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.37.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.36.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.36.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.35.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.34.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.33.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.7.0 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.32.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb