Skip to content
Snippets Groups Projects
Unverified Commit c89523ca authored by Ewoud Kohl van Wijngaarden's avatar Ewoud Kohl van Wijngaarden
Browse files

Move custom facts to their own file

This is makes it compatible with modulesync
parent 23ad9eab
Branches
Tags
No related merge requests found
...@@ -3,33 +3,6 @@ ...@@ -3,33 +3,6 @@
require 'voxpupuli/test/spec_helper' require 'voxpupuli/test/spec_helper'
# Rough conversion of grepping in the puppet source:
# grep defaultfor lib/puppet/provider/service/*.rb
add_custom_fact :service_provider, ->(os, facts) do
case facts[:osfamily].downcase
when 'archlinux'
'systemd'
when 'darwin'
'launchd'
when 'debian'
'systemd'
when 'freebsd'
'freebsd'
when 'gentoo'
'openrc'
when 'openbsd'
'openbsd'
when 'redhat'
facts[:operatingsystemrelease].to_i >= 7 ? 'systemd' : 'redhat'
when 'suse'
facts[:operatingsystemmajrelease].to_i >= 12 ? 'systemd' : 'redhat'
when 'windows'
'windows'
else
'init'
end
end
def get_content(subject, title) def get_content(subject, title)
is_expected.to contain_file(title) is_expected.to contain_file(title)
content = subject.resource('file', title).send(:parameters)[:content] content = subject.resource('file', title).send(:parameters)[:content]
......
# This fact is provided by puppetlabs-stdlib and uses the actual provider for
# service. A rough conversion of grepping in the puppet source:
# grep defaultfor lib/puppet/provider/service/*.rb
add_custom_fact :service_provider, ->(os, facts) do
case facts[:osfamily].downcase
when 'archlinux'
'systemd'
when 'darwin'
'launchd'
when 'debian'
'systemd'
when 'freebsd'
'freebsd'
when 'gentoo'
'openrc'
when 'openbsd'
'openbsd'
when 'redhat'
facts[:operatingsystemrelease].to_i >= 7 ? 'systemd' : 'redhat'
when 'suse'
facts[:operatingsystemmajrelease].to_i >= 12 ? 'systemd' : 'redhat'
when 'windows'
'windows'
else
'init'
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment