Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe9e12d2b4 | ||
|
|
7df975ad18 | ||
|
|
1f071f1b96 | ||
|
|
a94f5195e0 | ||
|
|
e12dbd2f9a | ||
|
|
4805628682 | ||
|
|
816958fed1 | ||
|
|
bf7edcf299 | ||
|
|
3556af3a49 | ||
|
|
d3398aa52b | ||
|
|
c0d41b043a | ||
|
|
c0e3e81a3f | ||
|
|
0f69865c3d | ||
|
|
e7b585b346 | ||
|
|
45c4d89261 | ||
|
|
454a1c73f7 | ||
|
|
2d70d838ba | ||
|
|
50a23d1704 | ||
|
|
aa89d8b510 | ||
|
|
e73f175f3a | ||
|
|
90485daa12 | ||
|
|
86024aeef8 | ||
|
|
9188f0e15a | ||
|
|
6f7cdb76b4 | ||
|
|
ad93b44405 | ||
|
|
9fcf5d1a23 | ||
|
|
d531f47e8f | ||
|
|
8ab5b99a56 | ||
|
|
3ac6dd5966 | ||
|
|
cde7046e99 | ||
|
|
44280b3535 | ||
|
|
f85cbd5381 | ||
|
|
bd50a396ef | ||
|
|
b46f256b11 | ||
|
|
5091d7fd6a | ||
|
|
f7a95a1e0e | ||
|
|
f5ee99f297 | ||
|
|
b637c2e7e7 | ||
|
|
5007be2226 | ||
|
|
4b54bab0cb | ||
|
|
1d5c5992ab | ||
|
|
6a4ca4f7c7 | ||
|
|
d15243493b | ||
|
|
1f7545b213 | ||
|
|
ff80bc7f79 | ||
|
|
995b985d37 | ||
|
|
234fd7b650 | ||
|
|
7264c4022e | ||
|
|
017a749d13 | ||
|
|
e37f6d5af6 | ||
|
|
c797e52851 | ||
|
|
4ab58a2f88 | ||
|
|
3afa0813ea | ||
|
|
4d7154516d | ||
|
|
d027d35e2d | ||
|
|
30b07259a2 | ||
|
|
6365fcd9f2 | ||
|
|
a671ad7cc4 | ||
|
|
0e4dc2dd81 | ||
|
|
4c1161891b | ||
|
|
98e1d30235 | ||
|
|
b5854b3ef3 | ||
|
|
e6be2ed785 | ||
|
|
b547e53a8b | ||
|
|
3b674ac225 | ||
|
|
8a7c2fce30 | ||
|
|
babdde5f02 | ||
|
|
0b541605e1 | ||
|
|
8aa2053c9d | ||
|
|
12544569fb | ||
|
|
e09792cea9 | ||
|
|
3b00510615 | ||
|
|
07ea32a90c | ||
|
|
c503afd73e | ||
|
|
cc1dd231e3 | ||
|
|
221a6d3dab | ||
|
|
7efde2db1e |
5
.fixtures.yml
Normal file
5
.fixtures.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
stdlib: http://github.com/puppetlabs/puppetlabs-stdlib.git
|
||||
symlinks:
|
||||
java: "#{source_dir}"
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,2 +1,7 @@
|
||||
pkg/
|
||||
.DS_Store
|
||||
metadata.json
|
||||
spec/fixtures
|
||||
*.idea
|
||||
*.swp
|
||||
*.tmp
|
||||
40
.travis.yml
Normal file
40
.travis.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
language: ruby
|
||||
bundler_args: --without development
|
||||
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||
after_success:
|
||||
- git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-releng
|
||||
- .forge-releng/publish
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
env:
|
||||
matrix:
|
||||
- PUPPET_GEM_VERSION="~> 2.7.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.0.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.1.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.2.0"
|
||||
global:
|
||||
- PUBLISHER_LOGIN=puppetlabs
|
||||
- secure: |-
|
||||
InMPZJVSGFC/AfcTbM6eKpYjPU3L1m1/P8BiXwcwreeyz0elsX2qmXk80A1h
|
||||
\nakUY6VxLtzcFGBHV1V8NvpRHovUBSzRGuhSFUm72XL62OB6TMl+Wg30coJ
|
||||
/N\nXjEfy7N5TQ3ThTKf1gfph0x/3iJBPgqIuIIELJCQJusTRDPKWYQ=
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 3.0.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 3.1.0"
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 3.2.0"
|
||||
notifications:
|
||||
email: false
|
||||
45
CHANGELOG
45
CHANGELOG
@@ -1,3 +1,48 @@
|
||||
1.0.1 (2013-08-01)
|
||||
|
||||
Matthaus Owens <matthaus@puppetlabs.com>
|
||||
* Update java packages for Fedora systems
|
||||
|
||||
1.0.0 (2013-07-29)
|
||||
|
||||
Krzysztof Suszyński <krzysztof.suszynski@coi.gov.pl>
|
||||
* Adding support for Oracle Enterprise Linux
|
||||
|
||||
Peter Drake <pdrake@allplayers.com>
|
||||
* Add support for natty
|
||||
|
||||
Robert Munteanu <rmuntean@adobe.com>
|
||||
* Add support for OpenSUSE
|
||||
|
||||
Martin Jackson <martin@uncommonsense-uk.com>
|
||||
* Added support Amazon Linux using facter >= 1.7.x
|
||||
|
||||
Gareth Rushgrove <gareth@morethanseven.net>
|
||||
Brett Porter <brett@apache.org>
|
||||
* Fixes for older versions of CentOS
|
||||
* Improvements to module build and tests
|
||||
|
||||
Nathan R Valentine <nrvale0@gmail.com>
|
||||
* Add support for Ubuntu quantal and raring
|
||||
|
||||
Sharif Nassar <sharif@mediatemple.net>
|
||||
* Add support for Debian alternatives, and more than one JDK/JRE per platform.
|
||||
|
||||
2013-04-04 Reid Vandewiele <reid@puppetlabs.com> - 0.3.0
|
||||
* Refactor, introduce params pattern
|
||||
|
||||
2012-11-15 Scott Schneider <sschneider@puppetlabs.com> - 0.2.0
|
||||
* Add Solaris support
|
||||
|
||||
2011-06-16 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
|
||||
* Add Debian based distro (Lucid) support
|
||||
|
||||
2011-06-02 Jeff McCune <jeff@puppetlabs.com> - 0.1.4
|
||||
* Fix class composition ordering problems
|
||||
|
||||
2011-05-28 Jeff McCune <jeff@puppetlabs.com> - 0.1.3
|
||||
* Remove stages
|
||||
|
||||
2011-05-26 Jeff McCune <jeff@puppetlabs.com> - 0.1.2
|
||||
* Changes JRE/JDK selection class parameter to $distribution
|
||||
|
||||
|
||||
15
Gemfile
Normal file
15
Gemfile
Normal file
@@ -0,0 +1,15 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
if ENV.key?('PUPPET_VERSION')
|
||||
puppetversion = "= #{ENV['PUPPET_VERSION']}"
|
||||
elsif ENV.key?('PUPPET_GEM_VERSION')
|
||||
puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
else
|
||||
puppetversion = ['~> 2.7']
|
||||
end
|
||||
|
||||
gem "rake"
|
||||
gem "puppet", puppetversion
|
||||
gem "puppet-lint"
|
||||
gem "rspec-puppet"
|
||||
gem "puppetlabs_spec_helper"
|
||||
43
Gemfile.lock
Normal file
43
Gemfile.lock
Normal file
@@ -0,0 +1,43 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
diff-lcs (1.2.2)
|
||||
facter (1.7.2)
|
||||
hiera (1.2.1)
|
||||
json_pure
|
||||
json_pure (1.8.0)
|
||||
metaclass (0.0.1)
|
||||
mocha (0.13.3)
|
||||
metaclass (~> 0.0.1)
|
||||
puppet (3.2.3)
|
||||
facter (~> 1.6)
|
||||
hiera (~> 1.0)
|
||||
rgen (~> 0.6.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)
|
||||
rgen (0.6.5)
|
||||
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 (~> 3.2.0)
|
||||
puppet-lint
|
||||
puppetlabs_spec_helper
|
||||
rake
|
||||
rspec-puppet
|
||||
17
LICENSE
Normal file
17
LICENSE
Normal file
@@ -0,0 +1,17 @@
|
||||
Puppet Java Module - Puppet module for managing Java
|
||||
|
||||
Copyright (C) 2011 Puppet Labs Inc
|
||||
|
||||
Puppet Labs can be contacted at: info@puppetlabs.com
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,5 +1,5 @@
|
||||
name 'puppetlabs-java'
|
||||
version '0.1.2'
|
||||
version '1.0.1'
|
||||
source 'git://github.com/puppetlabs/puppetlabs-java'
|
||||
author 'puppetlabs'
|
||||
license 'Apache'
|
||||
@@ -7,5 +7,4 @@ summary 'Manage the official Java runtime'
|
||||
description 'Manage the official Java runtime'
|
||||
project_page 'https://github.com/puppetlabs/puppetlabs-java'
|
||||
|
||||
## Add dependencies, if any:
|
||||
dependency 'puppetlabs/stdlib', '>= 0.1.3'
|
||||
dependency 'puppetlabs/stdlib', '>= 0.1.6'
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
# Java #
|
||||
#Java
|
||||
|
||||
Manage the Java runtime for use with other application software.
|
||||
|
||||
Currently this simply deploys the package on Enterprise Linux based systems.
|
||||
|
||||
The Java runtime this module is designed to configure are the RPM's provided by Oracle and obtained by extracting them from the "bin" installers.
|
||||
|
||||
For example:
|
||||
|
||||
./jdk-6u25-linux-x64-rpm.bin -x
|
||||
|
||||
Please download the installer from:
|
||||
|
||||
* [Java Downloads](http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html)
|
||||
|
||||
Currently this deploys the correct Java package on a variety of platforms.
|
||||
|
||||
5
Rakefile
Normal file
5
Rakefile
Normal 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}"
|
||||
17
manifests/config.pp
Normal file
17
manifests/config.pp
Normal file
@@ -0,0 +1,17 @@
|
||||
# On Debian systems, if alternatives are set, manually assign them.
|
||||
class java::config ( ) {
|
||||
case $::osfamily {
|
||||
Debian: {
|
||||
if $java::use_java_alternative != undef and $java::use_java_alternative_path != undef {
|
||||
exec { 'update-java-alternatives':
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
command => "update-java-alternatives --set ${java::use_java_alternative} --jre",
|
||||
unless => "test /etc/alternatives/java -ef '${java::use_java_alternative_path}'",
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
# Do nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,40 +4,91 @@
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*distribution*]
|
||||
# The java distribution to install. Can be one of "jdk" or "jre",
|
||||
# or other platform-specific options where there are multiple
|
||||
# implementations available (eg: OpenJDK vs Oracle JDK).
|
||||
#
|
||||
#
|
||||
# [*version*]
|
||||
# The version of java to install. By default, this module simply ensures
|
||||
# that java is present, and does not require a specific version.
|
||||
#
|
||||
# [*package*]
|
||||
# The name of the java package. This is configurable in case a non-standard
|
||||
# java package is desired.
|
||||
#
|
||||
# [*java_alternative*]
|
||||
# The name of the java alternative to use on Debian systems.
|
||||
# "update-java-alternatives -l" will show which choices are available.
|
||||
# If you specify a particular package, you will almost always also
|
||||
# want to specify which java_alternative to choose. If you set
|
||||
# this, you also need to set the path below.
|
||||
#
|
||||
# [*java_alternative_path*]
|
||||
# The path to the "java" command on Debian systems. Since the
|
||||
# alternatives system makes it difficult to verify which
|
||||
# alternative is actually enabled, this is required to ensure the
|
||||
# correct JVM is enabled.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# [Remember: No empty lines between comments and class definition]
|
||||
class java(
|
||||
$distribution = 'jdk',
|
||||
$version = 'installed'
|
||||
$version = 'present',
|
||||
$package = undef,
|
||||
$java_alternative = undef,
|
||||
$java_alternative_path = undef
|
||||
) {
|
||||
include java::params
|
||||
|
||||
# Cannot pass anonymous arrays to functions in 2.6.8
|
||||
$v_distribution = [ '^jre$', '^jdk$' ]
|
||||
# Must compare string values, not booleans.
|
||||
validate_re($version, '^[._0-9a-zA-Z:-]+$')
|
||||
validate_re($distribution, $v_distribution)
|
||||
validate_re($version, 'present|installed|latest|^[._0-9a-zA-Z:-]+$')
|
||||
|
||||
$version_real = $version
|
||||
$distribution_real = $distribution
|
||||
if has_key($java::params::java, $distribution) {
|
||||
$default_package_name = $java::params::java[$distribution]['package']
|
||||
$default_alternative = $java::params::java[$distribution]['alternative']
|
||||
$default_alternative_path = $java::params::java[$distribution]['alternative_path']
|
||||
} else {
|
||||
fail("Java distribution ${distribution} is not supported.")
|
||||
}
|
||||
|
||||
case $distribution_real {
|
||||
jre: {
|
||||
class { 'java::jre_package':
|
||||
version => $version_real,
|
||||
stage => 'runtime',
|
||||
}
|
||||
}
|
||||
jdk: {
|
||||
class { 'java::jdk_package':
|
||||
version => $version_real,
|
||||
stage => 'runtime',
|
||||
$use_java_package_name = $package ? {
|
||||
default => $package,
|
||||
undef => $default_package_name,
|
||||
}
|
||||
|
||||
## If $java_alternative is set, use that.
|
||||
## Elsif the DEFAULT package is being used, then use $default_alternative.
|
||||
## Else undef
|
||||
$use_java_alternative = $java_alternative ? {
|
||||
default => $java_alternative,
|
||||
undef => $use_java_package_name ? {
|
||||
$default_package_name => $default_alternative,
|
||||
default => undef,
|
||||
}
|
||||
}
|
||||
|
||||
## Same logic as $java_alternative above.
|
||||
$use_java_alternative_path = $java_alternative_path ? {
|
||||
default => $java_alternative_path,
|
||||
undef => $use_java_package_name ? {
|
||||
$default_package_name => $default_alternative_path,
|
||||
default => undef,
|
||||
}
|
||||
}
|
||||
|
||||
anchor { 'java::begin:': }
|
||||
->
|
||||
package { 'java':
|
||||
ensure => $version,
|
||||
name => $use_java_package_name,
|
||||
}
|
||||
->
|
||||
class { 'java::config': }
|
||||
-> anchor { 'java::end': }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# Class: java:jdk_package
|
||||
#
|
||||
# This class installs the Java JDK package
|
||||
# produced from ./jdk-6u25-linux-x64-rpm.bin -x
|
||||
#
|
||||
# This is the "Official" RPM distributed by Oracle
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class java::jdk_package (
|
||||
$version
|
||||
) {
|
||||
|
||||
validate_re($version, '^[._0-9a-zA-Z:-]+$')
|
||||
|
||||
$version_real = $version
|
||||
|
||||
package { 'jdk':
|
||||
ensure => $version_real,
|
||||
alias => 'java',
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
# Class: java:jre_package
|
||||
#
|
||||
# class description goes here.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class java::jre_package (
|
||||
$version
|
||||
) {
|
||||
|
||||
validate_re($version, '^[._0-9a-zA-Z:-]+$')
|
||||
|
||||
$version_real = $version
|
||||
|
||||
package { 'jre':
|
||||
ensure => $version_real,
|
||||
alias => 'java',
|
||||
}
|
||||
|
||||
}
|
||||
125
manifests/params.pp
Normal file
125
manifests/params.pp
Normal file
@@ -0,0 +1,125 @@
|
||||
# Class: java::params
|
||||
#
|
||||
# This class builds a hash of JDK/JRE packages and (for Debian)
|
||||
# alternatives. For wheezy/precise, we provide Oracle JDK/JRE
|
||||
# options, even though those are not in the package repositories.
|
||||
#
|
||||
# For more info on how to package Oracle JDK/JRE, see the Debian wiki:
|
||||
# http://wiki.debian.org/JavaPackage
|
||||
#
|
||||
# Because the alternatives system makes it very difficult to tell
|
||||
# which Java alternative is enabled, we hard code the path to bin/java
|
||||
# for the config class to test if it is enabled.
|
||||
class java::params {
|
||||
|
||||
case $::osfamily {
|
||||
default: { fail("unsupported platform ${::osfamily}") }
|
||||
'RedHat': {
|
||||
case $::operatingsystem {
|
||||
default: { fail("unsupported os ${::operatingsystem}") }
|
||||
'RedHat', 'CentOS', 'OracleLinux': {
|
||||
if (versioncmp($::operatingsystemrelease, '5.0') < 0) {
|
||||
$jdk_package = 'java-1.6.0-sun-devel'
|
||||
$jre_package = 'java-1.6.0-sun'
|
||||
}
|
||||
elsif (versioncmp($::operatingsystemrelease, '6.3') < 0) {
|
||||
$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': {
|
||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||
$jre_package = 'java-1.7.0-openjdk'
|
||||
}
|
||||
'Amazon': {
|
||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||
$jre_package = 'java-1.7.0-openjdk'
|
||||
}
|
||||
}
|
||||
$java = {
|
||||
'jdk' => { 'package' => $jdk_package, },
|
||||
'jre' => { 'package' => $jre_package, },
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
case $::lsbdistcodename {
|
||||
default: { fail("unsupported release ${::lsbdistcodename}") }
|
||||
'lenny', 'squeeze', 'lucid', 'natty': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
'package' => 'openjdk-6-jdk',
|
||||
'alternative' => 'java-6-openjdk',
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java',
|
||||
},
|
||||
'jre' => {
|
||||
'package' => 'openjdk-6-jre-headless',
|
||||
'alternative' => 'java-6-openjdk',
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java',
|
||||
},
|
||||
'sun-jre' => {
|
||||
'package' => 'sun-java6-jre',
|
||||
'alternative' => 'java-6-sun',
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-sun/jre/bin/java',
|
||||
},
|
||||
'sun-jdk' => {
|
||||
'package' => 'sun-java6-jdk',
|
||||
'alternative' => 'java-6-sun',
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-sun/jre/bin/java',
|
||||
},
|
||||
}
|
||||
}
|
||||
'wheezy', 'precise','quantal','raring': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
'package' => 'openjdk-7-jdk',
|
||||
'alternative' => "java-1.7.0-openjdk-${::architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/bin/java",
|
||||
},
|
||||
'jre' => {
|
||||
'package' => 'openjdk-7-jre-headless',
|
||||
'alternative' => "java-1.7.0-openjdk-${::architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/bin/java",
|
||||
},
|
||||
'oracle-jre' => {
|
||||
'package' => 'oracle-j2re1.7',
|
||||
'alternative' => 'j2re1.7-oracle',
|
||||
'alternative_path' => '/usr/lib/jvm/j2re1.7-oracle/bin/java',
|
||||
},
|
||||
'oracle-jdk' => {
|
||||
'package' => 'oracle-j2sdk1.7',
|
||||
'alternative' => 'j2sdk1.7-oracle',
|
||||
'alternative_path' => '/usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java',
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
$java = {
|
||||
'jdk' => { 'package' => 'developer/java/jdk-7', },
|
||||
'jre' => { 'package' => 'runtime/java/jre-7', },
|
||||
}
|
||||
}
|
||||
'Suse': {
|
||||
case $::operatingsystem {
|
||||
default: {
|
||||
$jdk_package = 'java-1_6_0-ibm-devel'
|
||||
$jre_package = 'java-1_6_0-ibm'
|
||||
}
|
||||
|
||||
'OpenSuSE': {
|
||||
$jdk_package = 'java-1_7_0-openjdk-devel'
|
||||
$jre_package = 'java-1_7_0-openjdk'
|
||||
}
|
||||
}
|
||||
$java = {
|
||||
'jdk' => { 'package' => $jdk_package, },
|
||||
'jre' => { 'package' => $jre_package, },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
+-----------------------------------------------------------------------+
|
||||
| |
|
||||
| ==> DO NOT EDIT THIS FILE! <== |
|
||||
| |
|
||||
| You should edit the `Modulefile` and run `puppet-module build` |
|
||||
| to generate the `metadata.json` file for your releases. |
|
||||
| |
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
{}
|
||||
109
spec/classes/java_spec.rb
Normal file
109
spec/classes/java_spec.rb
Normal file
@@ -0,0 +1,109 @@
|
||||
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 openjdk for Fedora' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora'} }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
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') }
|
||||
it { should_not contain_exec('update-java-alternatives') }
|
||||
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') }
|
||||
it { should_not contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select default for Debian Wheezy' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
|
||||
it { should contain_package('java').with_name('openjdk-7-jdk') }
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE for Debian Wheezy' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', } }
|
||||
let(:params) { { 'distribution' => 'oracle-jre' } }
|
||||
it { should contain_package('java').with_name('oracle-j2re1.7') }
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') }
|
||||
end
|
||||
|
||||
context 'select default for Debian Squeeze' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5'} }
|
||||
it { should contain_package('java').with_name('openjdk-6-jdk') }
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk --jre') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE for Debian Squeeze' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5'} }
|
||||
let(:params) { { 'distribution' => 'sun-jre', } }
|
||||
it { should contain_package('java').with_name('sun-java6-jre') }
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') }
|
||||
end
|
||||
|
||||
context 'select random alternative for Debian Wheezy' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1'} }
|
||||
let(:params) { { 'java_alternative' => 'bananafish' } }
|
||||
it { should contain_package('java').with_name('openjdk-7-jdk') }
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Amazon Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64'} }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Amazon Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4'} }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux 6.2' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2'} }
|
||||
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Oracle Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select default for OpenSUSE 12.3' do
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3'}}
|
||||
it { should contain_package('java').with_name('java-1_7_0-openjdk-devel')}
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
--format
|
||||
s
|
||||
--colour
|
||||
--loadby
|
||||
mtime
|
||||
--backtrace
|
||||
@@ -1,18 +1 @@
|
||||
require 'pathname'
|
||||
dir = Pathname.new(__FILE__).parent
|
||||
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
|
||||
|
||||
require 'mocha'
|
||||
require 'puppet'
|
||||
gem 'rspec', '=1.2.9'
|
||||
require 'spec/autorun'
|
||||
|
||||
Spec::Runner.configure do |config|
|
||||
config.mock_with :mocha
|
||||
end
|
||||
|
||||
# We need this because the RAL uses 'should' as a method. This
|
||||
# allows us the same behaviour but with a different method name.
|
||||
class Object
|
||||
alias :must :should
|
||||
end
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
include java
|
||||
class { 'java':
|
||||
distribution => 'jdk',
|
||||
version => 'latest',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user