Merge pull request #552 from apenney/improve-graceful-failures

Handle graceful failure on RHEL4 and improve the messaging.
This commit is contained in:
Morgan Haskel 2014-08-08 12:27:26 -04:00
commit c70fc13fc1
3 changed files with 7 additions and 4 deletions

View file

@ -241,7 +241,7 @@ class mysql::params {
} }
default: { default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat, Debian, and FreeBSD, or operatingsystem Amazon") fail("Unsupported platform: puppetlabs-${module_name} currently doesn't support ${::osfamily} or ${::operatingsystem}")
} }
} }
} }
@ -303,4 +303,8 @@ class mysql::params {
}, },
} }
## Additional graceful failures
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '4' {
fail("Unsupported platform: puppetlabs-${module_name} only supports RedHat 5.0 and beyond")
}
} }

View file

@ -7,8 +7,7 @@ describe 'mysql::server' do
let(:facts) { facts } let(:facts) { facts }
context 'should gracefully fail' do context 'should gracefully fail' do
it { should_not contain_class('mysql::server') } it { expect { should compile}.to raise_error(Puppet::Error, /Unsupported platform:/) }
it { should raise_error(/Unsupported osfamily: foo/) }
end end
end end
end end

View file

@ -67,7 +67,7 @@ describe 'mysql::bindings' do
end end
it 'should fail' do it 'should fail' do
expect { subject }.to raise_error(/Unsupported osfamily: foo/) expect { subject }.to raise_error(/Unsupported platform:/)
end end
end end