Skip to content

Commit

Permalink
Fix facts usage when selecting repo class
Browse files Browse the repository at this point in the history
This fixes a bug introduced in voxpupuli#357 where Debian repositories were being
selected on Ubuntu.
  • Loading branch information
dbeckham authored and Mike Newton committed Oct 5, 2020
1 parent 09cc3bf commit 4f081f3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
case $facts['os']['family'] {
'Debian': {
# no contain here because apt does that already
case $facts['os']['family'] {
case $facts['os']['name'] {
'Debian': {
include ::php::repo::debian
}
Expand Down
28 changes: 28 additions & 0 deletions spec/classes/php_repo_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

describe 'php::repo', type: :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end

describe 'when configuring a package repo' do
case facts[:osfamily]
when 'Debian'
case facts[:operatingsystem]
when 'Debian'
it { is_expected.to contain_class('php::repo::debian') }
when 'Ubuntu'
it { is_expected.to contain_class('php::repo::ubuntu') }
end
when 'Suse'
it { is_expected.to contain_class('php::repo::suse') }
when 'RedHat'
it { is_expected.to contain_class('php::repo::redhat') }
end
end

end
end
end

0 comments on commit 4f081f3

Please sign in to comment.