Skip to content

Commit 9c6ce9c

Browse files
committed
Avoid downcasing facts in service provider
If the os.name or os.family 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 fc70183 commit 9c6ce9c

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
@@ -22,9 +22,9 @@ def self.defpath
2222
# Debian and Ubuntu should use the Debian provider.
2323
# RedHat systems should use the RedHat provider.
2424
confine :true => begin
25-
os = Puppet.runtime[:facter].value('os.name').downcase
26-
family = Puppet.runtime[:facter].value('os.family').downcase
27-
!(os == 'debian' || os == 'ubuntu' || family == 'redhat')
25+
os = Puppet.runtime[:facter].value('os.name')
26+
family = Puppet.runtime[:facter].value('os.family')
27+
!(os == 'Debian' || os == 'Ubuntu' || family == 'RedHat')
2828
end
2929

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

0 commit comments

Comments
 (0)