Merge branch 'master' into bugfix_FM-7520
This commit is contained in:
@@ -19,6 +19,10 @@ AllCops:
|
||||
Metrics/LineLength:
|
||||
Description: People have wide screens, use them.
|
||||
Max: 200
|
||||
GetText/DecorateString:
|
||||
Description: We don't want to decorate test output.
|
||||
Exclude:
|
||||
- spec/*
|
||||
RSpec/BeforeAfterAll:
|
||||
Description: Beware of using after(:all) as it may cause state to leak between tests.
|
||||
A necessary evil in acceptance testing.
|
||||
|
||||
15
.travis.yml
15
.travis.yml
@@ -13,26 +13,26 @@ script:
|
||||
- 'bundle exec rake $CHECK'
|
||||
bundler_args: --without system_tests
|
||||
rvm:
|
||||
- 2.4.4
|
||||
- 2.5.0
|
||||
env:
|
||||
global:
|
||||
- BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0"
|
||||
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
-
|
||||
bundler_args:
|
||||
dist: trusty
|
||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
|
||||
rvm: 2.4.4
|
||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
|
||||
rvm: 2.5.0
|
||||
script: bundle exec rake beaker
|
||||
services: docker
|
||||
sudo: required
|
||||
-
|
||||
bundler_args:
|
||||
dist: trusty
|
||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
|
||||
rvm: 2.4.4
|
||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
|
||||
rvm: 2.5.0
|
||||
script: bundle exec rake beaker
|
||||
services: docker
|
||||
sudo: required
|
||||
@@ -40,6 +40,9 @@ matrix:
|
||||
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
|
||||
-
|
||||
env: CHECK=parallel_spec
|
||||
-
|
||||
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
|
||||
rvm: 2.4.4
|
||||
-
|
||||
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
|
||||
rvm: 2.1.9
|
||||
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
|
||||
|
||||
## [3.2.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.2.0) (2018-09-27)
|
||||
|
||||
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.1.0...3.2.0)
|
||||
|
||||
### Added
|
||||
|
||||
- pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#317](https://github.com/puppetlabs/puppetlabs-java/pull/317) ([tphoney](https://github.com/tphoney))
|
||||
|
||||
## [3.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.1.0) (2018-09-06)
|
||||
|
||||
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.0.0...3.1.0)
|
||||
|
||||
### Added
|
||||
|
||||
- pdksync - \(MODULES-7705\) - Bumping stdlib dependency from \< 5.0.0 to \< 6.0.0 [\#310](https://github.com/puppetlabs/puppetlabs-java/pull/310) ([pmcmaw](https://github.com/pmcmaw))
|
||||
|
||||
## [3.0.0](https://github.com/puppetlabs/puppetlabs-java/tree/3.0.0) (2018-08-13)
|
||||
|
||||
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/2.4.0...3.0.0)
|
||||
|
||||
22
Gemfile
22
Gemfile
@@ -1,25 +1,18 @@
|
||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
||||
|
||||
def location_for(place_or_version, fake_version = nil)
|
||||
if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
|
||||
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
|
||||
elsif place_or_version =~ %r{\Afile:\/\/(.*)}
|
||||
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
|
||||
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
|
||||
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
|
||||
|
||||
if place_or_version && (git_url = place_or_version.match(git_url_regex))
|
||||
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
|
||||
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
|
||||
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
|
||||
else
|
||||
[place_or_version, { require: false }]
|
||||
end
|
||||
end
|
||||
|
||||
def gem_type(place_or_version)
|
||||
if place_or_version =~ %r{\Agit[:@]}
|
||||
:git
|
||||
elsif !place_or_version.nil? && place_or_version.start_with?('file:')
|
||||
:file
|
||||
else
|
||||
:gem
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
|
||||
minor_version = ruby_version_segments[0..1].join('.')
|
||||
|
||||
@@ -41,7 +34,6 @@ group :system_tests do
|
||||
end
|
||||
|
||||
puppet_version = ENV['PUPPET_GEM_VERSION']
|
||||
puppet_type = gem_type(puppet_version)
|
||||
facter_version = ENV['FACTER_GEM_VERSION']
|
||||
hiera_version = ENV['HIERA_GEM_VERSION']
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class java::config ( ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
'FreeBSD', 'Suse': {
|
||||
'Suse': {
|
||||
if $java::use_java_home != undef {
|
||||
file_line { 'java-home-environment':
|
||||
path => '/etc/environment',
|
||||
@@ -53,6 +53,20 @@ class java::config ( ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
'FreeBSD': {
|
||||
if $java::use_java_home != undef {
|
||||
file_line { 'java-home-environment-profile':
|
||||
path => '/etc/profile',
|
||||
line => "JAVA_HOME=${$java::use_java_home}; export JAVA_HOME",
|
||||
match => 'JAVA_HOME=',
|
||||
}
|
||||
file_line { 'java-home-environment-cshrc':
|
||||
path => '/etc/csh.login',
|
||||
line => "setenv JAVA_HOME ${$java::use_java_home}",
|
||||
match => 'setenv JAVA_HOME',
|
||||
}
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
if $java::use_java_home != undef {
|
||||
file_line { 'java-home-environment':
|
||||
|
||||
@@ -87,6 +87,9 @@
|
||||
# Directory hash used by the download.oracle.com site. This value is a 32 character string
|
||||
# which is part of the file URL returned by the JDK download site.
|
||||
#
|
||||
# [*jce*]
|
||||
# Install Oracles Java Cryptographic Extensions into the JRE or JDK
|
||||
#
|
||||
# ### Author
|
||||
# mike@marseglia.org
|
||||
#
|
||||
@@ -101,6 +104,7 @@ define java::oracle (
|
||||
$proxy_type = undef,
|
||||
$url = undef,
|
||||
$url_hash = undef,
|
||||
$jce = false,
|
||||
) {
|
||||
|
||||
# archive module is used to download the java package
|
||||
@@ -111,6 +115,15 @@ define java::oracle (
|
||||
fail('Java SE must be either jre or jdk.')
|
||||
}
|
||||
|
||||
if $jce {
|
||||
$jce_download = $version ? {
|
||||
'8' => 'http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip',
|
||||
'7' => 'http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip',
|
||||
'6' => 'http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip',
|
||||
default => undef
|
||||
}
|
||||
}
|
||||
|
||||
# determine Oracle Java major and minor version, and installation path
|
||||
if $version_major and $version_minor {
|
||||
|
||||
@@ -119,7 +132,13 @@ define java::oracle (
|
||||
$release_hash = $url_hash
|
||||
|
||||
if $release_major =~ /(\d+)u(\d+)/ {
|
||||
$install_path = "${java_se}1.${1}.0_${2}"
|
||||
# Required for CentOS systems where Java8 update number is >= 171 to ensure
|
||||
# the package is visible to Puppet
|
||||
if $facts['os']['family'] == 'RedHat' and $2 >= '171' {
|
||||
$install_path = "${java_se}1.${1}.0_${2}-amd64"
|
||||
} else {
|
||||
$install_path = "${java_se}1.${1}.0_${2}"
|
||||
}
|
||||
} else {
|
||||
$install_path = "${java_se}${release_major}${release_minor}"
|
||||
}
|
||||
@@ -139,16 +158,16 @@ define java::oracle (
|
||||
$release_hash = undef
|
||||
}
|
||||
'8' : {
|
||||
$release_major = '8u131'
|
||||
$release_minor = 'b11'
|
||||
$install_path = "${java_se}1.8.0_131"
|
||||
$release_hash = 'd54c1d3a095b4ff2b6607d096fa80163'
|
||||
$release_major = '8u192'
|
||||
$release_minor = 'b12'
|
||||
$install_path = "${java_se}1.8.0_192"
|
||||
$release_hash = '750e1c8617c5452694857ad95c3ee230'
|
||||
}
|
||||
default : {
|
||||
$release_major = '8u131'
|
||||
$release_minor = 'b11'
|
||||
$install_path = "${java_se}1.8.0_131"
|
||||
$release_hash = 'd54c1d3a095b4ff2b6607d096fa80163'
|
||||
$release_major = '8u192'
|
||||
$release_minor = 'b12'
|
||||
$install_path = "${java_se}1.8.0_192"
|
||||
$release_hash = '750e1c8617c5452694857ad95c3ee230'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +200,11 @@ define java::oracle (
|
||||
fail ( "unsupported platform ${$facts['kernel']}" ) }
|
||||
}
|
||||
|
||||
# Install required unzip packages for jce
|
||||
if $jce {
|
||||
ensure_resource('package', 'unzip', { 'ensure' => 'present' })
|
||||
}
|
||||
|
||||
# set java architecture nomenclature
|
||||
case $facts['os']['architecture'] {
|
||||
'i386' : { $arch = 'i586' }
|
||||
@@ -263,20 +287,44 @@ define java::oracle (
|
||||
}
|
||||
case $facts['kernel'] {
|
||||
'Linux' : {
|
||||
exec { "Install Oracle java_se ${java_se} ${version}" :
|
||||
case $facts['os']['family'] {
|
||||
'Debian' : {
|
||||
ensure_resource('file', '/usr/lib/jvm', {
|
||||
ensure => directory,
|
||||
})
|
||||
$install_requires = [Archive[$destination], File['/usr/lib/jvm']]
|
||||
}
|
||||
default : {
|
||||
$install_requires = [Archive[$destination]]
|
||||
}
|
||||
}
|
||||
exec { "Install Oracle java_se ${java_se} ${version} ${release_major} ${release_minor}" :
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
|
||||
command => $install_command,
|
||||
creates => $creates_path,
|
||||
require => Archive[$destination]
|
||||
require => $install_requires
|
||||
}
|
||||
case $facts['os']['family'] {
|
||||
'Debian' : {
|
||||
file{'/usr/lib/jvm':
|
||||
ensure => directory,
|
||||
before => Exec["Install Oracle java_se ${java_se} ${version}"]
|
||||
}
|
||||
|
||||
if ($jce and $jce_download != undef) {
|
||||
$jce_path = $java_se ? {
|
||||
'jre' => "${creates_path}/lib/security",
|
||||
'jdk' => "${creates_path}/jre/lib/security"
|
||||
}
|
||||
archive { "/tmp/jce-${version}.zip":
|
||||
source => $jce_download,
|
||||
cookie => 'gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie',
|
||||
extract => true,
|
||||
extract_path => $jce_path,
|
||||
extract_flags => '-oj',
|
||||
creates => "${jce_path}/US_export_policy.jar",
|
||||
cleanup => false,
|
||||
proxy_server => $proxy_server,
|
||||
proxy_type => $proxy_type,
|
||||
require => [
|
||||
Package['unzip'],
|
||||
Exec["Install Oracle java_se ${java_se} ${version} ${release_major} ${release_minor}"]
|
||||
]
|
||||
}
|
||||
default : { }
|
||||
}
|
||||
}
|
||||
default : {
|
||||
|
||||
@@ -74,18 +74,23 @@ class java::params {
|
||||
'amd64' => 'x64',
|
||||
default => $::architecture
|
||||
}
|
||||
$openjdk_architecture = $::architecture ? {
|
||||
'aarch64' => 'arm64',
|
||||
'armv7l' => 'armhf',
|
||||
default => $::architecture
|
||||
}
|
||||
case $::lsbdistcodename {
|
||||
'lenny', 'squeeze', 'lucid', 'natty': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
'package' => 'openjdk-6-jdk',
|
||||
'alternative' => "java-6-openjdk-${::architecture}",
|
||||
'alternative' => "java-6-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java',
|
||||
'java_home' => '/usr/lib/jvm/java-6-openjdk/jre/',
|
||||
},
|
||||
'jre' => {
|
||||
'package' => 'openjdk-6-jre-headless',
|
||||
'alternative' => "java-6-openjdk-${::architecture}",
|
||||
'alternative' => "java-6-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java',
|
||||
'java_home' => '/usr/lib/jvm/java-6-openjdk/jre/',
|
||||
},
|
||||
@@ -107,15 +112,15 @@ class java::params {
|
||||
$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",
|
||||
'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/",
|
||||
'alternative' => "java-1.7.0-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/",
|
||||
},
|
||||
'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",
|
||||
'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${::architecture}/",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.7.0-openjdk-${openjdk_architecture}/",
|
||||
},
|
||||
'oracle-jre' => {
|
||||
'package' => 'oracle-j2re1.7',
|
||||
@@ -155,19 +160,35 @@ class java::params {
|
||||
},
|
||||
}
|
||||
}
|
||||
'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful', 'bionic': {
|
||||
'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
'package' => 'openjdk-8-jdk',
|
||||
'alternative' => "java-1.8.0-openjdk-${::architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/",
|
||||
'alternative' => "java-1.8.0-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/",
|
||||
},
|
||||
'jre' => {
|
||||
'package' => 'openjdk-8-jre-headless',
|
||||
'alternative' => "java-1.8.0-openjdk-${::architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${::architecture}/",
|
||||
'alternative' => "java-1.8.0-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.8.0-openjdk-${openjdk_architecture}/",
|
||||
}
|
||||
}
|
||||
}
|
||||
'bionic': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
'package' => 'openjdk-11-jdk',
|
||||
'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/",
|
||||
},
|
||||
'jre' => {
|
||||
'package' => 'openjdk-11-jre-headless',
|
||||
'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}",
|
||||
'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java",
|
||||
'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppetlabs-java",
|
||||
"version": "3.0.0",
|
||||
"version": "3.2.0",
|
||||
"author": "puppetlabs",
|
||||
"summary": "Installs the correct Java package on various platforms.",
|
||||
"license": "Apache-2.0",
|
||||
@@ -10,7 +10,7 @@
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "puppetlabs/stdlib",
|
||||
"version_requirement": ">= 4.13.1 < 5.0.0"
|
||||
"version_requirement": ">= 4.13.1 < 6.0.0"
|
||||
},
|
||||
{
|
||||
"name": "puppet/archive",
|
||||
@@ -73,10 +73,10 @@
|
||||
"requirements": [
|
||||
{
|
||||
"name": "puppet",
|
||||
"version_requirement": ">= 4.7.0 < 6.0.0"
|
||||
"version_requirement": ">= 4.7.0 < 7.0.0"
|
||||
}
|
||||
],
|
||||
"template-url": "https://github.com/puppetlabs/pdk-templates",
|
||||
"template-ref": "1.7.0-0-g57412ed",
|
||||
"template-ref": "heads/master-0-gabccfb1",
|
||||
"pdk-version": "1.7.0"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
include Unix::File
|
||||
|
||||
# RedHat, CentOS, Scientific, Oracle prior to 5.0 : Sun Java JDK/JRE 1.6
|
||||
# RedHat, CentOS, Scientific, Oracle 5.0 < x < 6.3 : OpenJDK Java JDK/JRE 1.6
|
||||
# RedHat, CentOS, Scientific, Oracle after 6.3 : OpenJDK Java JDK/JRE 1.7
|
||||
@@ -79,6 +81,62 @@ bogus_alternative = "class { 'java':\n"\
|
||||
" java_alternative_path => '/whatever',\n"\
|
||||
'}'
|
||||
|
||||
# Oracle installs are disabled by default, because the links to valid oracle installations
|
||||
# change often. Look the parameters up from the Oracle download URLs at https://java.oracle.com and
|
||||
# enable the tests:
|
||||
|
||||
oracle_enabled = false
|
||||
oracle_version_major = '8'
|
||||
oracle_version_minor = '192'
|
||||
oracle_version_build = '12'
|
||||
oracle_hash = '750e1c8617c5452694857ad95c3ee230'
|
||||
|
||||
install_oracle_jre = <<EOL
|
||||
java::oracle {
|
||||
'test_oracle_jre':
|
||||
version => '#{oracle_version_major}',
|
||||
version_major => '#{oracle_version_major}u#{oracle_version_minor}',
|
||||
version_minor => 'b#{oracle_version_build}',
|
||||
url_hash => '#{oracle_hash}',
|
||||
java_se => 'jre',
|
||||
}
|
||||
EOL
|
||||
|
||||
install_oracle_jdk = <<EOL
|
||||
java::oracle {
|
||||
'test_oracle_jdk':
|
||||
version => '#{oracle_version_major}',
|
||||
version_major => '#{oracle_version_major}u#{oracle_version_minor}',
|
||||
version_minor => 'b#{oracle_version_build}',
|
||||
url_hash => '#{oracle_hash}',
|
||||
java_se => 'jdk',
|
||||
}
|
||||
EOL
|
||||
|
||||
install_oracle_jre_jce = <<EOL
|
||||
java::oracle {
|
||||
'test_oracle_jre':
|
||||
version => '#{oracle_version_major}',
|
||||
version_major => '#{oracle_version_major}u#{oracle_version_minor}',
|
||||
version_minor => 'b#{oracle_version_build}',
|
||||
url_hash => '#{oracle_hash}',
|
||||
java_se => 'jre',
|
||||
jce => true,
|
||||
}
|
||||
EOL
|
||||
|
||||
install_oracle_jdk_jce = <<EOL
|
||||
java::oracle {
|
||||
'test_oracle_jdk':
|
||||
version => '#{oracle_version_major}',
|
||||
version_major => '#{oracle_version_major}u#{oracle_version_minor}',
|
||||
version_minor => 'b#{oracle_version_build}',
|
||||
url_hash => '#{oracle_hash}',
|
||||
java_se => 'jdk',
|
||||
jce => true,
|
||||
}
|
||||
EOL
|
||||
|
||||
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
||||
it 'installs jre' do
|
||||
apply_manifest(java_class_jre, catch_failures: true)
|
||||
@@ -155,3 +213,37 @@ context 'with failure cases' do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Test oracle java installs
|
||||
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
||||
install_path = '/usr/lib/jvm'
|
||||
version_suffix = ''
|
||||
if fact('osfamily') == 'RedHat' || fact('osfamily') == 'Amazon'
|
||||
install_path = '/usr/java'
|
||||
version_suffix = '-amd64'
|
||||
end
|
||||
it 'installs oracle jdk' do
|
||||
apply_manifest(install_oracle_jdk, catch_failures: true)
|
||||
apply_manifest(install_oracle_jdk, catch_changes: true)
|
||||
result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
||||
expect(result.exit_code).to eq(0)
|
||||
end
|
||||
it 'installs oracle jre' do
|
||||
apply_manifest(install_oracle_jre, catch_failures: true)
|
||||
apply_manifest(install_oracle_jre, catch_changes: true)
|
||||
result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
||||
expect(result.exit_code).to eq(0)
|
||||
end
|
||||
it 'installs oracle jdk with jce' do
|
||||
apply_manifest(install_oracle_jdk_jce, catch_failures: true)
|
||||
apply_manifest(install_oracle_jdk_jce, catch_changes: true)
|
||||
result = shell("test -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
||||
expect(result.exit_code).to eq(0)
|
||||
end
|
||||
it 'installs oracle jre with jce' do
|
||||
apply_manifest(install_oracle_jre_jce, catch_failures: true)
|
||||
apply_manifest(install_oracle_jre_jce, catch_changes: true)
|
||||
result = shell("test -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
||||
expect(result.exit_code).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,6 +69,22 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') }
|
||||
end
|
||||
|
||||
context 'when select jdk for Ubuntu xenial (16.04) on ARM' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemrelease: '16.04', architecture: 'armv7l' } }
|
||||
let(:params) { { 'distribution' => 'jdk' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-armhf/') }
|
||||
end
|
||||
|
||||
context 'when select jdk for Ubuntu xenial (16.04) on ARM64' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemrelease: '16.04', architecture: 'aarch64' } }
|
||||
let(:params) { { 'distribution' => 'jdk' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-arm64/') }
|
||||
end
|
||||
|
||||
context 'when select openjdk for Amazon Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Amazon', operatingsystemrelease: '3.4.43-43.43.amzn1.x86_64', architecture: 'x86_64' } }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Facts specified here will override the values provided by rspec-puppet-facts.
|
||||
---
|
||||
concat_basedir: "/tmp"
|
||||
concat_basedir: ""
|
||||
ipaddress: "172.16.254.254"
|
||||
is_pe: false
|
||||
macaddress: "AA:AA:AA:AA:AA:AA"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz'
|
||||
oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/8u192-b12/750e1c8617c5452694857ad95c3ee230/jdk-8u192-linux-x64.tar.gz'
|
||||
|
||||
describe 'java::oracle', type: :define do
|
||||
context 'with CentOS 64-bit' do
|
||||
@@ -11,8 +11,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-x64-rpm.bin]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-x64-rpm.bin]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 7 JDK' do
|
||||
@@ -20,17 +20,17 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-x64.rpm]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-x64.rpm]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 8 JDK' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } }
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u131-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-x64.rpm]') }
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').with_command('rpm --force -iv /tmp/jdk-8u192-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').that_requires('Archive[/tmp/jdk-8u192-linux-x64.rpm]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 6 JRE' do
|
||||
@@ -38,8 +38,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jre6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-x64-rpm.bin]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-x64-rpm.bin]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 7 JRE' do
|
||||
@@ -47,35 +47,35 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jre7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-x64.rpm]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-x64.rpm]') }
|
||||
end
|
||||
|
||||
context 'when select Oracle Java SE 8 JRE' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } }
|
||||
let(:title) { 'jre8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u131-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-x64.rpm]') }
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u192-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').with_command('rpm --force -iv /tmp/jre-8u192-linux-x64.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').that_requires('Archive[/tmp/jre-8u192-linux-x64.rpm]') }
|
||||
end
|
||||
|
||||
context 'when passing URL to url parameter' do
|
||||
let(:params) do
|
||||
{
|
||||
ensure: 'present',
|
||||
version_major: '8u131',
|
||||
version_minor: 'b11',
|
||||
version_major: '8u192',
|
||||
version_minor: 'b12',
|
||||
java_se: 'jdk',
|
||||
url: 'http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm',
|
||||
url: 'http://download.oracle.com/otn-pub/java/jdk/8u192-b12/750e1c8617c5452694857ad95c3ee230/jdk-8u192-linux-x64.rpm',
|
||||
url_hash: 'ignored',
|
||||
}
|
||||
end
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it {
|
||||
is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm')
|
||||
.with_source('http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm')
|
||||
is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.rpm')
|
||||
.with_source('http://download.oracle.com/otn-pub/java/jdk/8u192-b12/750e1c8617c5452694857ad95c3ee230/jdk-8u192-linux-x64.rpm')
|
||||
}
|
||||
end
|
||||
|
||||
@@ -83,15 +83,66 @@ describe 'java::oracle', type: :define do
|
||||
let(:params) do
|
||||
{
|
||||
ensure: 'present',
|
||||
version_major: '8u131',
|
||||
version_minor: 'b11',
|
||||
version_major: '8u192',
|
||||
version_minor: 'b12',
|
||||
java_se: 'jdk',
|
||||
url_hash: 'abcdef01234567890',
|
||||
url_hash: '750e1c8617c5452694857ad95c3ee230',
|
||||
}
|
||||
end
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.rpm').with_source('http://download.oracle.com/otn-pub/java/jdk//8u131-b11/abcdef01234567890/jdk-8u131-linux-x64.rpm') }
|
||||
it {
|
||||
is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.rpm')
|
||||
.with_source('http://download.oracle.com/otn-pub/java/jdk//8u192-b12/750e1c8617c5452694857ad95c3ee230/jdk-8u192-linux-x64.rpm')
|
||||
}
|
||||
end
|
||||
|
||||
context 'when installing multiple versions' do
|
||||
let(:params) do
|
||||
{
|
||||
ensure: 'present',
|
||||
version_major: '8u192',
|
||||
version_minor: 'b12',
|
||||
java_se: 'jdk',
|
||||
url_hash: '750e1c8617c5452694857ad95c3ee230',
|
||||
}
|
||||
end
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
let(:pre_condition) do
|
||||
<<-EOL
|
||||
java::oracle {
|
||||
'jdk8121':
|
||||
ensure => 'present',
|
||||
version_major => '8u121',
|
||||
version_minor => 'b13',
|
||||
java_se => 'jdk',
|
||||
url_hash => 'abcdef01234567890',
|
||||
}
|
||||
EOL
|
||||
end
|
||||
|
||||
it { is_expected.to compile }
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JRE with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jre1.6.0_99-amd64/lib/security')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JDK with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jdk1.6.0_99-amd64/jre/lib/security')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,8 +154,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-i586-rpm.bin]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-i586-rpm.bin]') }
|
||||
end
|
||||
|
||||
context 'when selecting Oracle Java SE 7 JDK on RedHat family, 32-bit' do
|
||||
@@ -112,17 +163,17 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-i586.rpm]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-i586.rpm]') }
|
||||
end
|
||||
|
||||
context 'when selecting Oracle Java SE 8 JDK on RedHat family, 32-bit' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } }
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u131-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-i586.rpm]') }
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').with_command('rpm --force -iv /tmp/jdk-8u192-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').that_requires('Archive[/tmp/jdk-8u192-linux-i586.rpm]') }
|
||||
end
|
||||
|
||||
context 'when selecting Oracle Java SE 6 JRE on RedHat family, 32-bit' do
|
||||
@@ -130,8 +181,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-i586-rpm.bin]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-i586-rpm.bin]') }
|
||||
end
|
||||
|
||||
context 'when select Oracle Java SE 7 JRE on RedHat family, 32-bit' do
|
||||
@@ -139,17 +190,65 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-i586.rpm]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-i586.rpm]') }
|
||||
end
|
||||
|
||||
context 'when select Oracle Java SE 8 JRE on RedHat family, 32-bit' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } }
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u131-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u131-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-i586.rpm]') }
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u192-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').with_command('rpm --force -iv /tmp/jre-8u192-linux-i586.rpm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').that_requires('Archive[/tmp/jre-8u192-linux-i586.rpm]') }
|
||||
end
|
||||
|
||||
context 'when installing multiple versions' do
|
||||
let(:params) do
|
||||
{
|
||||
ensure: 'present',
|
||||
version_major: '8u192',
|
||||
version_minor: 'b12',
|
||||
java_se: 'jdk',
|
||||
url_hash: '750e1c8617c5452694857ad95c3ee230',
|
||||
}
|
||||
end
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
let(:pre_condition) do
|
||||
<<-EOL
|
||||
java::oracle {
|
||||
'jdk8121':
|
||||
ensure => 'present',
|
||||
version_major => '8u121',
|
||||
version_minor => 'b13',
|
||||
java_se => 'jdk',
|
||||
url_hash => 'abcdef01234567890',
|
||||
}
|
||||
EOL
|
||||
end
|
||||
|
||||
it { is_expected.to compile }
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JRE with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jre1.6.0_99-amd64/lib/security')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JDK with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/java/jdk1.6.0_99-amd64/jre/lib/security')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -161,8 +260,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('tar -zxf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6').that_requires('Archive[/tmp/jdk-6u45-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').with_command('tar -zxf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 6 6u45 b06').that_requires('Archive[/tmp/jdk-6u45-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'with Oracle Java SE 7 JDK' do
|
||||
@@ -170,17 +269,17 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jdk7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('tar -zxf /tmp/jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7').that_requires('Archive[/tmp/jdk-7u80-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').with_command('tar -zxf /tmp/jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 7 7u80 b15').that_requires('Archive[/tmp/jdk-7u80-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'with Oracle Java SE 8 JDK' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jdk' } }
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('tar -zxf /tmp/jdk-8u131-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8').that_requires('Archive[/tmp/jdk-8u131-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').with_command('tar -zxf /tmp/jdk-8u192-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u192 b12').that_requires('Archive[/tmp/jdk-8u192-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'with Oracle Java SE 6 JRE' do
|
||||
@@ -188,8 +287,8 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jre6' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('tar -zxf /tmp/jre-6u45-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6').that_requires('Archive[/tmp/jre-6u45-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').with_command('tar -zxf /tmp/jre-6u45-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 6 6u45 b06').that_requires('Archive[/tmp/jre-6u45-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 7 JRE' do
|
||||
@@ -197,24 +296,72 @@ describe 'java::oracle', type: :define do
|
||||
let(:title) { 'jre7' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('tar -zxf /tmp/jre-7u80-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7').that_requires('Archive[/tmp/jre-7u80-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').with_command('tar -zxf /tmp/jre-7u80-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 7 7u80 b15').that_requires('Archive[/tmp/jre-7u80-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'when Oracle Java SE 8 JRE' do
|
||||
let(:params) { { ensure: 'present', version: '8', java_se: 'jre' } }
|
||||
let(:title) { 'jre8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u131-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('tar -zxf /tmp/jre-8u131-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8').that_requires('Archive[/tmp/jre-8u131-linux-x64.tar.gz]') }
|
||||
it { is_expected.to contain_archive('/tmp/jre-8u192-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').with_command('tar -zxf /tmp/jre-8u192-linux-x64.tar.gz -C /usr/lib/jvm') }
|
||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u192 b12').that_requires('Archive[/tmp/jre-8u192-linux-x64.tar.gz]') }
|
||||
end
|
||||
|
||||
context 'when passing URL to url parameter' do
|
||||
let(:params) { { ensure: 'present', version_major: '8u131', version_minor: 'b11', java_se: 'jdk', url: oracle_url.to_s } }
|
||||
let(:params) { { ensure: 'present', version_major: '8u192', version_minor: 'b12', java_se: 'jdk', url: oracle_url.to_s } }
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u131-linux-x64.tar.gz') }
|
||||
it { is_expected.to contain_archive('/tmp/jdk-8u192-linux-x64.tar.gz') }
|
||||
end
|
||||
|
||||
context 'when installing multiple versions' do
|
||||
let(:params) do
|
||||
{
|
||||
ensure: 'present',
|
||||
version_major: '8u192',
|
||||
version_minor: 'b12',
|
||||
java_se: 'jdk',
|
||||
url_hash: '750e1c8617c5452694857ad95c3ee230',
|
||||
}
|
||||
end
|
||||
let(:title) { 'jdk8' }
|
||||
|
||||
let(:pre_condition) do
|
||||
<<-EOL
|
||||
java::oracle {
|
||||
'jdk8121':
|
||||
ensure => 'present',
|
||||
version_major => '8u121',
|
||||
version_minor => 'b13',
|
||||
java_se => 'jdk',
|
||||
url_hash => 'abcdef01234567890',
|
||||
}
|
||||
EOL
|
||||
end
|
||||
|
||||
it { is_expected.to compile }
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JRE with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jre' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/lib/jvm/jre1.6.0_99/lib/security')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when installing Oracle Java SE 6 JDK with JCE' do
|
||||
let(:params) { { ensure: 'present', jce: true, version: '6', version_major: '6u99', version_minor: '99', java_se: 'jdk' } }
|
||||
let(:title) { 'jre6jce' }
|
||||
|
||||
it do
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_source('http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip')
|
||||
is_expected.to contain_archive('/tmp/jce-6.zip').with_extract_path('/usr/lib/jvm/jdk1.6.0_99/jre/lib/security')
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'incompatible OSes' do
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'rspec-puppet-facts'
|
||||
|
||||
begin
|
||||
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
|
||||
rescue LoadError => loaderror
|
||||
warn "Could not require spec_helper_local: #{loaderror.message}"
|
||||
end
|
||||
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
|
||||
|
||||
include RspecPuppetFacts
|
||||
|
||||
@@ -14,15 +10,19 @@ default_facts = {
|
||||
facterversion: Facter.version,
|
||||
}
|
||||
|
||||
default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
|
||||
default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
|
||||
default_fact_files = [
|
||||
File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
|
||||
File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
|
||||
]
|
||||
|
||||
if File.exist?(default_facts_path) && File.readable?(default_facts_path)
|
||||
default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
|
||||
end
|
||||
default_fact_files.each do |f|
|
||||
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
|
||||
|
||||
if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
|
||||
default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
|
||||
begin
|
||||
default_facts.merge!(YAML.safe_load(File.read(f)))
|
||||
rescue => e
|
||||
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
require 'beaker-pe'
|
||||
require 'beaker-puppet'
|
||||
require 'beaker-rspec'
|
||||
require 'beaker/puppet_install_helper'
|
||||
require 'beaker/module_install_helper'
|
||||
|
||||
run_puppet_install_helper
|
||||
configure_type_defaults_on(hosts)
|
||||
install_module_on(hosts)
|
||||
install_module_dependencies_on(hosts)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user