Commit 5239cc8d authored by Tim Smith's avatar Tim Smith
Browse files

Move chef_solo_search_installed to the helper library

parent 38058d5e
......@@ -2,7 +2,7 @@ module RsyslogCookbook
# helpers for the various service providers on Ubuntu systems
module Helpers
# use the correct provider based on the Ubuntu release
def find_provider
def find_service_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'])
......@@ -15,7 +15,7 @@ module RsyslogCookbook
# declare the service with the appropriate provider if on Ubuntu
def declare_rsyslog_service
service_provider = 'ubuntu' == node['platform'] ? find_provider : nil
service_provider = 'ubuntu' == node['platform'] ? find_service_provider : nil
service node['rsyslog']['service_name'] do
supports restart: true, status: true
......@@ -23,5 +23,14 @@ module RsyslogCookbook
provider service_provider
end
end
# determine if chef solo search is available
def chef_solo_search_installed?
klass = ::Search.const_get('Helper')
return klass.is_a?(Class)
rescue NameError
return false
end
end
end
......@@ -19,15 +19,9 @@
# Do not run this recipe if the server attribute is set
return if node['rsyslog']['server']
include_recipe 'rsyslog::default'
def chef_solo_search_installed?
klass = ::Search.const_get('Helper')
return klass.is_a?(Class)
rescue NameError
return false
end
extend RsyslogCookbook::Helpers
# On Chef Solo, we use the node['rsyslog']['server_ip'] attribute, and on
# normal Chef, we leverage the search query.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment