Skip to content

Commit

Permalink
Fix for failing repo on Amazon Linux #821
Browse files Browse the repository at this point in the history
Use repository for rhel 6 on Amazon linux
Experimental retrospec generated tests for sensu::repo classes
Refactored tests for sensu::repo::yum
  • Loading branch information
alvagante committed Oct 25, 2017
1 parent b2438bb commit d5577cd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
8 changes: 6 additions & 2 deletions manifests/repo/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
if $::sensu::repo_source {
$url = $::sensu::repo_source
} else {
$releasever = $::operatingsystem ? {
'Amazon' => '6',
default => '$releasever',
}
$url = $::sensu::repo ? {
'unstable' => "https://sensu.global.ssl.fastly.net/yum-unstable/\$releasever/\$basearch/",
default => "https://sensu.global.ssl.fastly.net/yum/\$releasever/\$basearch/"
'unstable' => "https://sensu.global.ssl.fastly.net/yum-unstable/${releasever}/\$basearch/",
default => "https://sensu.global.ssl.fastly.net/yum/${releasever}/\$basearch/"
}
}

Expand Down
6 changes: 6 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
"14.04",
"16.04"
]
},
{
"operatingsystem": "Amazon",
"operatingsystemrelease": [
"2017.03"
]
}
],
"requirements": [
Expand Down
33 changes: 33 additions & 0 deletions spec/classes/repo/yum_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'spec_helper'

describe 'sensu::repo::yum' do

context 'on RedHat derivatives' do
let(:facts) do
{ :osfamily => 'RedHat' }
end
is_expected.to contain_yumrepo('sensu').with( {
'enabled' => '1',
'baseurl' => 'https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/',
'gpgcheck' => '0',
'name' => 'sensu',
'descr' => 'sensu',
'before' => 'Package[sensu]',
})
end

context 'on Amazon Linux' do
let(:facts) do
{ :operatingsystem => 'Amazon' }
end
is_expected.to contain_yumrepo('sensu').with( {
'enabled' => '1',
'baseurl' => 'https://sensu.global.ssl.fastly.net/yum/6/$basearch/',
'gpgcheck' => '0',
'name' => 'sensu',
'descr' => 'sensu',
'before' => 'Package[sensu]',
})
end

end

0 comments on commit d5577cd

Please sign in to comment.