Skip to content

Commit 4dc7185

Browse files
committed
Avoid downcasing facts in service provider
If the operatingsystem or osfamily fact is missing this will result in nil.downcase. In practice that's unlikely, but in some test scenarios it can happen. By using the properly cased values it removes the need to downcase, which is also slightly faster.
1 parent 1145d44 commit 4dc7185

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/puppet/provider/service/init.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def self.defpath
2121
# Debian and Ubuntu should use the Debian provider.
2222
# RedHat systems should use the RedHat provider.
2323
confine :true => begin
24-
os = Puppet.runtime[:facter].value(:operatingsystem).downcase
25-
family = Puppet.runtime[:facter].value(:osfamily).downcase
26-
!(os == 'debian' || os == 'ubuntu' || family == 'redhat')
24+
os = Puppet.runtime[:facter].value(:operatingsystem)
25+
family = Puppet.runtime[:facter].value(:osfamily)
26+
!(os == 'Debian' || os == 'Ubuntu' || family == 'RedHat')
2727
end
2828

2929
# We can't confine this here, because the init path can be overridden.

0 commit comments

Comments
 (0)