Merge branch 'fixes_for_centos_versions' of https://github.com/garethr/puppetlabs-java into garethr-fixes_for_centos_versions

Conflicts:
	Modulefile
	README.markdown
	manifests/init.pp
	spec/spec_helper.rb
This commit is contained in:
Brett Porter
2013-06-02 21:26:10 -07:00
9 changed files with 109 additions and 11 deletions

5
.fixtures.yml Normal file
View File

@@ -0,0 +1,5 @@
fixtures:
repositories:
stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git
symlinks:
java: "#{source_dir}"

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
pkg/ pkg/
.DS_Store .DS_Store
metadata.json metadata.json
spec/fixtures

13
Gemfile Normal file
View File

@@ -0,0 +1,13 @@
source "http://rubygems.org"
if ENV.key?('PUPPET_VERSION')
puppetversion = "= #{ENV['PUPPET_VERSION']}"
else
puppetversion = ['~> 2.7']
end
gem "rake"
gem "puppet", puppetversion
gem "puppet-lint"
gem "rspec-puppet"
gem "puppetlabs_spec_helper"

37
Gemfile.lock Normal file
View File

@@ -0,0 +1,37 @@
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.2.2)
facter (1.6.18)
metaclass (0.0.1)
mocha (0.13.3)
metaclass (~> 0.0.1)
puppet (2.7.21)
facter (~> 1.5)
puppet-lint (0.3.2)
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
rake
rspec (>= 2.9.0)
rspec-puppet (>= 0.1.1)
rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rspec-puppet (0.1.6)
rspec
PLATFORMS
ruby
DEPENDENCIES
puppet (~> 2.7)
puppet-lint
puppetlabs_spec_helper
rake
rspec-puppet

View File

@@ -1,11 +1,10 @@
name 'puppetlabs-java' name 'puppetlabs-java'
version '0.3.0' version '0.3.0'
source 'git://github.com/puppetlabs/puppetlabs-java' source 'git://github.com/puppetlabs/puppetlabs-java'
author 'puppetlabs' author 'puppetlabs'
license 'Apache' license 'Apache'
summary 'Manage the official Java runtime' summary 'Manage the official Java runtime'
description 'Manage the official Java runtime' description 'Manage the official Java runtime'
project_page 'https://github.com/puppetlabs/puppetlabs-java' project_page 'https://github.com/puppetlabs/puppetlabs-java'
## Add dependencies, if any: dependency 'puppetlabs/stdlib', '>= 0.1.6'
dependency 'puppetlabs/stdlib', '>= 0.1.6'

5
Rakefile Normal file
View File

@@ -0,0 +1,5 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"

View File

@@ -11,8 +11,14 @@ class java::params {
case $::operatingsystem { case $::operatingsystem {
default: { fail("unsupported os ${::operatingsystem}") } default: { fail("unsupported os ${::operatingsystem}") }
'RedHat', 'CentOS': { 'RedHat', 'CentOS': {
$jdk_package = 'java-1.7.0-openjdk-devel' if (versioncmp($::operatingsystemrelease, '6.3') < 0) {
$jre_package = 'java-1.7.0-openjdk' $jdk_package = 'java-1.6.0-openjdk-devel'
$jre_package = 'java-1.6.0-openjdk'
}
else {
$jdk_package = 'java-1.7.0-openjdk-devel'
$jre_package = 'java-1.7.0-openjdk'
}
} }
'Fedora': { 'Fedora': {
$jdk_package = 'java' $jdk_package = 'java'

31
spec/classes/java_spec.rb Normal file
View File

@@ -0,0 +1,31 @@
require 'spec_helper'
describe 'java', :type => :class do
context 'select openjdk for Centos 5.8' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') }
end
context 'select openjdk for Centos 6.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
end
context 'select openjdk for Centos 6.2' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') }
end
context 'select passed value for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
let(:params) { { 'package' => 'jdk' } }
it { should contain_package('java').with_name('jdk') }
end
context 'select default for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') }
end
end

1
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'