Skip to content

Commit

Permalink
Fix some CentOS 10 problems (#9).
Browse files Browse the repository at this point in the history
  • Loading branch information
dallinb committed Dec 28, 2016
1 parent e32e361 commit 202ceee
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
notify => Service['odoo']
}

if $::osfamily == 'RedHat' {
exec { '/usr/bin/systemctl daemon-reload':
refreshonly => true,
subscribe => Package['odoo'],
}
}

$defaults = {
path => $config_file,
require => Package['odoo'],
Expand Down
14 changes: 13 additions & 1 deletion spec/acceptance/odoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class { '::odoo':
describe 'Odoo 9 installation.' do
it 'should work with no errors' do
apply_manifest(install_odoo9_pp, catch_failures: true)
end

it 'should be idempotent' do
expect(apply_manifest(install_odoo9_pp,
catch_failures: true).exit_code).to be_zero
end
Expand All @@ -51,9 +54,15 @@ class { '::odoo':
package { 'odoo':
ensure => purged,
} ->
class { '::odoo::repo9':
class { 'odoo::repo9':
ensure => absent,
}
if $::osfamily == 'RedHat' {
exec { '/usr/bin/yum clean all':
before => Class['odoo::repo9'],
}
}
EOS

describe 'Uninstall Odoo 9.' do
Expand Down Expand Up @@ -90,6 +99,9 @@ class { '::odoo':
describe 'Odoo 10 installation.' do
it 'should work with no errors' do
apply_manifest(install_odoo10_pp, catch_failures: true)
end

it 'should be idempotent' do
expect(apply_manifest(install_odoo10_pp,
catch_failures: true).exit_code).to be_zero
end
Expand Down
26 changes: 25 additions & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,36 @@
end
end

context 'with defaults for all parameters' do
context 'with defaults for all parameters (debian)' do
let :facts do
{
osfamily: 'Debian'
}
end

it do
should compile
should have_resource_count(2)
should contain_class('odoo')
should contain_package('odoo')
should contain_service('odoo')
end
end

context 'with defaults for all parameters (red hat)' do
let :facts do
{
osfamily: 'RedHat'
}
end

it do
should compile
should have_resource_count(3)
should contain_class('odoo')
should contain_package('odoo')
should contain_service('odoo')
should contain_exec('/usr/bin/systemctl daemon-reload')
end
end
end

0 comments on commit 202ceee

Please sign in to comment.