Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mirror
rsyslog
Commits
5239cc8d
Commit
5239cc8d
authored
Nov 09, 2015
by
Tim Smith
Browse files
Move chef_solo_search_installed to the helper library
parent
38058d5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/helpers.rb
View file @
5239cc8d
...
...
@@ -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
recipes/client.rb
View file @
5239cc8d
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment