Sha256: 4f6626376952dac17c96325d65c75293a165dd789d093700b3db7106121c287b

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

module RsyslogCookbook
  # helpers for the various service providers on Ubuntu systems
  module Helpers
    def find_provider
      if Chef::VersionConstraint.new('>= 15.04').include?(node['platform_version'])
        service_provider = Chef::Provider::Service::Systemd
      elsif Chef::VersionConstraint.new('>= 12.04').include?(node['platform_version'])
        service_provider = Chef::Provider::Service::Upstart
      else
        service_provider = nil
      end
      service_provider
    end

    def declare_rsyslog_service
      service_provider = 'ubuntu' == node['platform'] ? find_provider : nil

      service node['rsyslog']['service_name'] do
        supports restart: true, status: true
        action   [:enable, :start]
        provider service_provider
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
from-scratch-0.7.0 cookbooks/rsyslog/libraries/helpers.rb
from-scratch-0.6.0 cookbooks/rsyslog/libraries/helpers.rb
from-scratch-0.5.0 cookbooks/rsyslog/libraries/helpers.rb