Sha256: c132d8915b505ca462a5c2a0558e1e5e4c5d3d65eb9de6d6e86387f8ded64c11

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# coding: utf-8


module Splash
  module ConfigUtilities
    include Splash::Constants
    include Splash::Helpers

    def addservice(options = {})
      local_service_file = search_file_in_gem "prometheus-splash", "templates/splashd.service"
      config = get_config
      self.extend Splash::Loggers
      log = get_logger
      log.info "Splashd Systemd Service installation"
      service_file = "splashd.service"
      systemd_path = "/etc/systemd/system"
      return { :case => :options_incompatibility, :more => "Systemd not avaible on this System" } if verify_folder({ :name => systemd_path}) == [:inexistant]
      log.item "Installing service file : #{service_file} in #{systemd_path}"
      if install_file source: local_service_file, target: "#{systemd_path}/#{service_file}", mode: "755", owner: config.user_root, group: config.group_root then
        return { :case => :quiet_exit, :more => "Splashd Systemd service installed" }
      else
        return { :case => :error_exit, :more => "Splashd Systemd service could not be installed" }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prometheus-splash-0.5.3 lib/splash/config/service.rb
prometheus-splash-0.5.2 lib/splash/config/service.rb
prometheus-splash-0.5.0 lib/splash/config/service.rb