Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b632db3a3e | ||
|
|
9c8d34f7e7 | ||
|
|
af9c6c1bbe | ||
|
|
70fa42b5c7 | ||
|
|
0026df5de1 | ||
|
|
ce58b6793e | ||
|
|
a7f5b49404 | ||
|
|
c3d6da014f | ||
|
|
ab9efa8405 | ||
|
|
983efef86a | ||
|
|
b9564626d3 | ||
|
|
ff0b03eb72 | ||
|
|
7b73f579c0 | ||
|
|
614d624e5d | ||
|
|
2bdc458965 | ||
|
|
48b5d0209d | ||
|
|
bd22547e1e | ||
|
|
77c18be58b | ||
|
|
88d31a7a64 | ||
|
|
2a81a6cd07 | ||
|
|
68e1d7681d | ||
|
|
9d0301b1ef | ||
|
|
ae2baf0006 | ||
|
|
4e36ff899c | ||
|
|
bcc6263e14 | ||
|
|
92a9700ad3 | ||
|
|
2c624c2800 | ||
|
|
2ede3f1f06 | ||
|
|
16fa2379a2 |
@@ -1,6 +1,9 @@
|
|||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
|
||||||
archive: "git://github.com/voxpupuli/puppet-archive.git"
|
archive: "git://github.com/voxpupuli/puppet-archive.git"
|
||||||
|
facts: 'git://github.com/puppetlabs/puppetlabs-facts.git'
|
||||||
|
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||||
|
puppet_agent: 'git://github.com/puppetlabs/puppetlabs-puppet_agent.git'
|
||||||
|
provision: 'git://github.com/puppetlabs/provision.git'
|
||||||
symlinks:
|
symlinks:
|
||||||
java: "#{source_dir}"
|
java: "#{source_dir}"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
require: rubocop-rspec
|
require:
|
||||||
|
- rubocop-rspec
|
||||||
|
- rubocop-i18n
|
||||||
AllCops:
|
AllCops:
|
||||||
DisplayCopNames: true
|
DisplayCopNames: true
|
||||||
TargetRubyVersion: '2.1'
|
TargetRubyVersion: '2.1'
|
||||||
@@ -12,6 +14,7 @@ AllCops:
|
|||||||
- "**/Rakefile"
|
- "**/Rakefile"
|
||||||
- pkg/**/*
|
- pkg/**/*
|
||||||
- spec/fixtures/**/*
|
- spec/fixtures/**/*
|
||||||
|
- spec/**/*
|
||||||
- vendor/**/*
|
- vendor/**/*
|
||||||
- "**/Puppetfile"
|
- "**/Puppetfile"
|
||||||
- "**/Vagrantfile"
|
- "**/Vagrantfile"
|
||||||
@@ -19,10 +22,12 @@ AllCops:
|
|||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Description: People have wide screens, use them.
|
Description: People have wide screens, use them.
|
||||||
Max: 200
|
Max: 200
|
||||||
|
GetText:
|
||||||
|
Enabled: false
|
||||||
GetText/DecorateString:
|
GetText/DecorateString:
|
||||||
Description: We don't want to decorate test output.
|
Description: We don't want to decorate test output.
|
||||||
Exclude:
|
Exclude:
|
||||||
- spec/*
|
- spec/**/*
|
||||||
RSpec/BeforeAfterAll:
|
RSpec/BeforeAfterAll:
|
||||||
Description: Beware of using after(:all) as it may cause state to leak between tests.
|
Description: Beware of using after(:all) as it may cause state to leak between tests.
|
||||||
A necessary evil in acceptance testing.
|
A necessary evil in acceptance testing.
|
||||||
|
|||||||
18
.sync.yml
18
.sync.yml
@@ -7,14 +7,7 @@
|
|||||||
unmanaged: true
|
unmanaged: true
|
||||||
|
|
||||||
.travis.yml:
|
.travis.yml:
|
||||||
docker_sets:
|
unmanaged: true
|
||||||
- set: docker/centos-7
|
|
||||||
- set: docker/ubuntu-14.04
|
|
||||||
docker_defaults:
|
|
||||||
bundler_args: ""
|
|
||||||
secure: ""
|
|
||||||
branches:
|
|
||||||
- release
|
|
||||||
|
|
||||||
appveyor.yml:
|
appveyor.yml:
|
||||||
delete: true
|
delete: true
|
||||||
@@ -26,15 +19,6 @@ Gemfile:
|
|||||||
git: 'https://github.com/skywinder/github-changelog-generator'
|
git: 'https://github.com/skywinder/github-changelog-generator'
|
||||||
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
|
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
|
||||||
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
|
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
|
||||||
required:
|
|
||||||
':system_tests':
|
|
||||||
- gem: 'puppet-module-posix-system-r#{minor_version}'
|
|
||||||
platforms: ruby
|
|
||||||
- gem: 'puppet-module-win-system-r#{minor_version}'
|
|
||||||
platforms:
|
|
||||||
- mswin
|
|
||||||
- mingw
|
|
||||||
- x64_mingw
|
|
||||||
|
|
||||||
spec/spec_helper.rb:
|
spec/spec_helper.rb:
|
||||||
mock_with: ':rspec'
|
mock_with: ':rspec'
|
||||||
|
|||||||
61
.travis.yml
61
.travis.yml
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
dist: xenial
|
||||||
language: ruby
|
language: ruby
|
||||||
cache: bundler
|
cache: bundler
|
||||||
before_install:
|
before_install:
|
||||||
@@ -25,20 +26,55 @@ matrix:
|
|||||||
-
|
-
|
||||||
bundler_args:
|
bundler_args:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
|
env: PLATFORMS=deb_puppet5
|
||||||
rvm: 2.5.3
|
rvm: 2.5.1
|
||||||
script: bundle exec rake beaker
|
before_script:
|
||||||
|
- bundle exec rake 'litmus:provision_list[travis_deb]'
|
||||||
|
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
|
||||||
|
- bundle exec rake 'litmus:install_agent[puppet5]'
|
||||||
|
- bundle exec rake litmus:install_module
|
||||||
|
script:
|
||||||
|
- bundle exec rake litmus:acceptance:parallel
|
||||||
services: docker
|
services: docker
|
||||||
stage: acceptance
|
|
||||||
sudo: required
|
sudo: required
|
||||||
-
|
-
|
||||||
bundler_args:
|
bundler_args:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
|
env: PLATFORMS=deb_puppet6
|
||||||
rvm: 2.5.3
|
rvm: 2.5.1
|
||||||
script: bundle exec rake beaker
|
before_script:
|
||||||
|
- bundle exec rake 'litmus:provision_list[travis_deb]'
|
||||||
|
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
|
||||||
|
- bundle exec rake 'litmus:install_agent[puppet6]'
|
||||||
|
- bundle exec rake litmus:install_module
|
||||||
|
script:
|
||||||
|
- bundle exec rake litmus:acceptance:parallel
|
||||||
|
services: docker
|
||||||
|
-
|
||||||
|
bundler_args:
|
||||||
|
dist: trusty
|
||||||
|
env: PLATFORMS=el_puppet5
|
||||||
|
rvm: 2.5.1
|
||||||
|
before_script:
|
||||||
|
- bundle exec rake 'litmus:provision_list[travis_el]'
|
||||||
|
- bundle exec rake 'litmus:install_agent[puppet5]'
|
||||||
|
- bundle exec rake litmus:install_module
|
||||||
|
script:
|
||||||
|
- bundle exec rake litmus:acceptance:parallel
|
||||||
|
services: docker
|
||||||
|
sudo: required
|
||||||
|
-
|
||||||
|
bundler_args:
|
||||||
|
dist: trusty
|
||||||
|
env: PLATFORMS=el_puppet6
|
||||||
|
rvm: 2.5.1
|
||||||
|
before_script:
|
||||||
|
- bundle exec rake 'litmus:provision_list[travis_el]'
|
||||||
|
- bundle exec rake 'litmus:install_agent[puppet6]'
|
||||||
|
- bundle exec rake litmus:install_module
|
||||||
|
script:
|
||||||
|
- bundle exec rake litmus:acceptance:parallel
|
||||||
services: docker
|
services: docker
|
||||||
stage: acceptance
|
|
||||||
sudo: required
|
sudo: required
|
||||||
-
|
-
|
||||||
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
|
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
|
||||||
@@ -61,12 +97,3 @@ branches:
|
|||||||
- release
|
- release
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
deploy:
|
|
||||||
provider: puppetforge
|
|
||||||
user: puppet
|
|
||||||
password:
|
|
||||||
secure: ""
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
all_branches: true
|
|
||||||
condition: "$DEPLOY_TO_FORGE = yes"
|
|
||||||
|
|||||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"jpogran.puppet-vscode",
|
||||||
|
"rebornix.Ruby"
|
||||||
|
]
|
||||||
|
}
|
||||||
19
CHANGELOG.md
19
CHANGELOG.md
@@ -2,6 +2,25 @@
|
|||||||
|
|
||||||
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).
|
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).
|
||||||
|
|
||||||
|
## [v5.0.0](https://github.com/puppetlabs/puppetlabs-java/tree/v5.0.0) (2019-07-29)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v4.1.0...v5.0.0)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- \[FM-8320\] Remove Oracle download [\#372](https://github.com/puppetlabs/puppetlabs-java/pull/372) ([carabasdaniel](https://github.com/carabasdaniel))
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- \(FM-8223\) converted to use litmus [\#376](https://github.com/puppetlabs/puppetlabs-java/pull/376) ([tphoney](https://github.com/tphoney))
|
||||||
|
- Add buster support, default to 11 [\#369](https://github.com/puppetlabs/puppetlabs-java/pull/369) ([mhjacks](https://github.com/mhjacks))
|
||||||
|
- Add support for debian buster [\#364](https://github.com/puppetlabs/puppetlabs-java/pull/364) ([TomRitserveldt](https://github.com/TomRitserveldt))
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- \(FM-8343\) use release numbers not lsbdistcodename [\#375](https://github.com/puppetlabs/puppetlabs-java/pull/375) ([tphoney](https://github.com/tphoney))
|
||||||
|
- Revert "Add support for debian buster" [\#374](https://github.com/puppetlabs/puppetlabs-java/pull/374) ([tphoney](https://github.com/tphoney))
|
||||||
|
|
||||||
## [v4.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/v4.1.0) (2019-05-29)
|
## [v4.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/v4.1.0) (2019-05-29)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v4.0.0...v4.1.0)
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v4.0.0...v4.1.0)
|
||||||
|
|||||||
12
Gemfile
12
Gemfile
@@ -23,16 +23,12 @@ group :development do
|
|||||||
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
|
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
|
||||||
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
||||||
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
||||||
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
|
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
|
||||||
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
|
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
|
||||||
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
||||||
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
||||||
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
|
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
|
||||||
end
|
end
|
||||||
group :system_tests do
|
|
||||||
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
|
|
||||||
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
|
||||||
end
|
|
||||||
|
|
||||||
puppet_version = ENV['PUPPET_GEM_VERSION']
|
puppet_version = ENV['PUPPET_GEM_VERSION']
|
||||||
facter_version = ENV['FACTER_GEM_VERSION']
|
facter_version = ENV['FACTER_GEM_VERSION']
|
||||||
|
|||||||
@@ -43,52 +43,14 @@ class { 'java' :
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The defined type `java::oracle` installs one or more versions of Oracle Java SE. `java::oracle` depends on [puppet/archive](https://github.com/voxpupuli/puppet-archive). By using `java::oracle` you agree to Oracle's licensing terms for Java SE.
|
The defined type `java::download` installs one or more versions of Java SE from a remote url. `java::download` depends on [puppet/archive](https://github.com/voxpupuli/puppet-archive).
|
||||||
|
|
||||||
|
To install Java to a non-default basedir (defaults: /usr/lib/jvm for Debian; /usr/java for RedHat):
|
||||||
```puppet
|
```puppet
|
||||||
java::oracle { 'jdk6' :
|
java::download { 'jdk8' :
|
||||||
ensure => 'present',
|
ensure => 'present',
|
||||||
version => '6',
|
|
||||||
java_se => 'jdk',
|
java_se => 'jdk',
|
||||||
}
|
url => 'http://myjava.repository/java.tgz",
|
||||||
|
|
||||||
java::oracle { 'jdk8' :
|
|
||||||
ensure => 'present',
|
|
||||||
version => '8',
|
|
||||||
java_se => 'jdk',
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To install a specific release of a Java version, e.g. 8u101-b13, provide both parameters `version_major` and `version_minor` as follows:
|
|
||||||
|
|
||||||
```puppet
|
|
||||||
java::oracle { 'jdk8' :
|
|
||||||
ensure => 'present',
|
|
||||||
version_major => '8u101',
|
|
||||||
version_minor => 'b13',
|
|
||||||
java_se => 'jdk',
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To install Oracle Java to a non-default basedir (defaults: /usr/lib/jvm for Debian; /usr/java for RedHat):
|
|
||||||
```puppet
|
|
||||||
java::oracle { 'jdk8' :
|
|
||||||
ensure => 'present',
|
|
||||||
version_major => '8u101',
|
|
||||||
version_minor => 'b13',
|
|
||||||
java_se => 'jdk',
|
|
||||||
basedir => '/custom/java',
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To ensure that a custom basedir is a directory before Oracle Java is installed (note: manage separately for custom ownership or perms):
|
|
||||||
```puppet
|
|
||||||
java::oracle { 'jdk8' :
|
|
||||||
ensure => 'present',
|
|
||||||
version_major => '8u101',
|
|
||||||
version_minor => 'b13',
|
|
||||||
java_se => 'jdk',
|
|
||||||
manage_basedir => true,
|
|
||||||
basedir => '/custom/java',
|
basedir => '/custom/java',
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -153,18 +115,6 @@ the binaries to a standard directory. Because of that, the path to this location
|
|||||||
is hardcoded in the `java_version` fact. Whenever you upgrade Java to a newer
|
is hardcoded in the `java_version` fact. Whenever you upgrade Java to a newer
|
||||||
version, you have to update the path in this fact.
|
version, you have to update the path in this fact.
|
||||||
|
|
||||||
#### FreeBSD
|
|
||||||
|
|
||||||
By default on FreeBSD, Puppet versions prior to 4.0 throw an error saying `pkgng` is not the default provider. To fix this, install the [zleslie/pkgng module](https://forge.puppetlabs.com/zleslie/pkgng) and set it as the default package provider:
|
|
||||||
|
|
||||||
```puppet
|
|
||||||
Package {
|
|
||||||
provider => 'pkgng',
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
On Puppet 4.0 and later, `pkgng` is included within Puppet and is the default package provider.
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. To contribute to Puppet projects, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
|
Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. To contribute to Puppet projects, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
|
||||||
|
|||||||
48
REFERENCE.md
48
REFERENCE.md
@@ -18,8 +18,7 @@ options, even though those are not in the package repositories.
|
|||||||
|
|
||||||
**Defined types**
|
**Defined types**
|
||||||
|
|
||||||
* [`java::oracle`](#javaoracle): Installs Oracle Java. By using this module you agree to the Oracle licensing
|
* [`java::download`](#javadownload): Installs Java from a url location.
|
||||||
agreement.
|
|
||||||
|
|
||||||
## Classes
|
## Classes
|
||||||
|
|
||||||
@@ -102,23 +101,13 @@ Default value: `undef`
|
|||||||
|
|
||||||
## Defined types
|
## Defined types
|
||||||
|
|
||||||
### java::oracle
|
### java::download
|
||||||
|
|
||||||
Defined Type java::oracle
|
Defined Type java::download
|
||||||
|
|
||||||
Install one or more versions of Oracle Java.
|
|
||||||
|
|
||||||
Uses the following to download the package and automatically accept
|
|
||||||
the licensing terms:
|
|
||||||
```
|
|
||||||
wget --no-cookies --no-check-certificate --header \
|
|
||||||
"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
|
|
||||||
"http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
The following parameters are available in the `java::oracle` defined type.
|
The following parameters are available in the `java::download` defined type.
|
||||||
|
|
||||||
##### `ensure`
|
##### `ensure`
|
||||||
|
|
||||||
@@ -160,14 +149,6 @@ Type of Java Standard Edition to install, jdk or jre.
|
|||||||
|
|
||||||
Default value: 'jdk'
|
Default value: 'jdk'
|
||||||
|
|
||||||
##### `oracle_url`
|
|
||||||
|
|
||||||
Data type: `Any`
|
|
||||||
|
|
||||||
Official Oracle URL to download binaries from.
|
|
||||||
|
|
||||||
Default value: 'http://download.oracle.com/otn-pub/java/jdk/'
|
|
||||||
|
|
||||||
##### `proxy_server`
|
##### `proxy_server`
|
||||||
|
|
||||||
Data type: `Any`
|
Data type: `Any`
|
||||||
@@ -188,18 +169,7 @@ Default value: `undef`
|
|||||||
|
|
||||||
Data type: `Any`
|
Data type: `Any`
|
||||||
|
|
||||||
Full URL, including oracle_url, release_major, release_minor and package_name, to
|
Full URL
|
||||||
download the Oracle java_se installer. Originally present but not used, activated
|
|
||||||
to workaround MODULES-5058.
|
|
||||||
|
|
||||||
Default value: `undef`
|
|
||||||
|
|
||||||
##### `url_hash`
|
|
||||||
|
|
||||||
Data type: `Any`
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Default value: `undef`
|
Default value: `undef`
|
||||||
|
|
||||||
@@ -211,6 +181,14 @@ Install Oracles Java Cryptographic Extensions into the JRE or JDK
|
|||||||
|
|
||||||
Default value: `false`
|
Default value: `false`
|
||||||
|
|
||||||
|
##### `jce_url`
|
||||||
|
|
||||||
|
Data type: `Any`
|
||||||
|
|
||||||
|
Full URL to the jce zip file
|
||||||
|
|
||||||
|
Default value: `undef`
|
||||||
|
|
||||||
##### `basedir`
|
##### `basedir`
|
||||||
|
|
||||||
Data type: `Any`
|
Data type: `Any`
|
||||||
|
|||||||
3
Rakefile
3
Rakefile
@@ -1,3 +1,4 @@
|
|||||||
|
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
|
||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppetlabs_spec_helper/rake_tasks'
|
||||||
require 'puppet-syntax/tasks/puppet-syntax'
|
require 'puppet-syntax/tasks/puppet-syntax'
|
||||||
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
|
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
|
||||||
@@ -14,7 +15,7 @@ end
|
|||||||
|
|
||||||
def changelog_project
|
def changelog_project
|
||||||
return unless Rake.application.top_level_tasks.include? "changelog"
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
|
returnVal = nil || JSON.load(File.read('metadata.json'))['source'].match(%r{.*/([^/]*)})[1]
|
||||||
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
|
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
|
||||||
puts "GitHubChangelogGenerator project:#{returnVal}"
|
puts "GitHubChangelogGenerator project:#{returnVal}"
|
||||||
returnVal
|
returnVal
|
||||||
|
|||||||
25
distelli-manifest.yml
Normal file
25
distelli-manifest.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
team-modules/puppetlabs-java:
|
||||||
|
PreBuild:
|
||||||
|
- source /opt/rh/rh-ruby25/enable
|
||||||
|
- echo "--- LETS update BUNDLER ---"
|
||||||
|
- bundle install --path vendor/bundle --jobs 3
|
||||||
|
Build:
|
||||||
|
- echo "--- PROVISIONING ---"
|
||||||
|
- source /opt/rh/rh-ruby25/enable
|
||||||
|
- bundle exec rake litmus:provision_list[release_checks]
|
||||||
|
- cat inventory.yaml
|
||||||
|
- echo "--- AGENT INSTALLATION ---"
|
||||||
|
- bundle exec rake litmus:install_agent
|
||||||
|
- echo "--- MODULE INSTALLATION ---"
|
||||||
|
- bundle exec rake litmus:install_module
|
||||||
|
- echo "--- TESTS RUNNING ---"
|
||||||
|
- bundle exec rake litmus:acceptance:parallel
|
||||||
|
AfterBuildSuccess:
|
||||||
|
- source /opt/rh/rh-ruby25/enable
|
||||||
|
- bundle exec rake litmus:tear_down
|
||||||
|
AfterBuildFailure:
|
||||||
|
- source /opt/rh/rh-ruby25/enable
|
||||||
|
- bundle exec rake litmus:tear_down
|
||||||
|
CommitData:
|
||||||
|
- RepoType: Git
|
||||||
|
- RepoPath: .
|
||||||
@@ -1,18 +1,8 @@
|
|||||||
# Defined Type java::oracle
|
# Defined Type java::download
|
||||||
#
|
#
|
||||||
# @summary
|
# @summary
|
||||||
# Installs Oracle Java. By using this module you agree to the Oracle licensing
|
# Installs Java from a url location.
|
||||||
# agreement.
|
|
||||||
#
|
#
|
||||||
# Install one or more versions of Oracle Java.
|
|
||||||
#
|
|
||||||
# Uses the following to download the package and automatically accept
|
|
||||||
# the licensing terms:
|
|
||||||
#```
|
|
||||||
# wget --no-cookies --no-check-certificate --header \
|
|
||||||
# "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
|
|
||||||
# "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
|
|
||||||
#```
|
|
||||||
#
|
#
|
||||||
# @param ensure
|
# @param ensure
|
||||||
# Install or remove the package.
|
# Install or remove the package.
|
||||||
@@ -29,9 +19,6 @@
|
|||||||
# @param java_se
|
# @param java_se
|
||||||
# Type of Java Standard Edition to install, jdk or jre.
|
# Type of Java Standard Edition to install, jdk or jre.
|
||||||
#
|
#
|
||||||
# @param oracle_url
|
|
||||||
# Official Oracle URL to download binaries from.
|
|
||||||
#
|
|
||||||
# @param proxy_server
|
# @param proxy_server
|
||||||
# Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive)
|
# Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive)
|
||||||
#
|
#
|
||||||
@@ -39,13 +26,7 @@
|
|||||||
# Proxy server type (none|http|https|ftp). (passed to archive)
|
# Proxy server type (none|http|https|ftp). (passed to archive)
|
||||||
#
|
#
|
||||||
# @param url
|
# @param url
|
||||||
# Full URL, including oracle_url, release_major, release_minor and package_name, to
|
# Full URL
|
||||||
# download the Oracle java_se installer. Originally present but not used, activated
|
|
||||||
# to workaround MODULES-5058.
|
|
||||||
#
|
|
||||||
# @param url_hash
|
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
# @param jce
|
# @param jce
|
||||||
# Install Oracles Java Cryptographic Extensions into the JRE or JDK
|
# Install Oracles Java Cryptographic Extensions into the JRE or JDK
|
||||||
@@ -72,17 +53,15 @@
|
|||||||
# @param symlink_name
|
# @param symlink_name
|
||||||
# The name for the optional symlink in the installation directory.
|
# The name for the optional symlink in the installation directory.
|
||||||
#
|
#
|
||||||
define java::oracle (
|
define java::download(
|
||||||
$ensure = 'present',
|
$ensure = 'present',
|
||||||
$version = '8',
|
$version = '8',
|
||||||
$version_major = undef,
|
$version_major = undef,
|
||||||
$version_minor = undef,
|
$version_minor = undef,
|
||||||
$java_se = 'jdk',
|
$java_se = 'jdk',
|
||||||
$oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/',
|
|
||||||
$proxy_server = undef,
|
$proxy_server = undef,
|
||||||
$proxy_type = undef,
|
$proxy_type = undef,
|
||||||
$url = undef,
|
$url = undef,
|
||||||
$url_hash = undef,
|
|
||||||
$jce = false,
|
$jce = false,
|
||||||
$jce_url = undef,
|
$jce_url = undef,
|
||||||
$basedir = undef,
|
$basedir = undef,
|
||||||
@@ -103,25 +82,17 @@ define java::oracle (
|
|||||||
if $jce {
|
if $jce {
|
||||||
if $jce_url {
|
if $jce_url {
|
||||||
$jce_download = $jce_url
|
$jce_download = $jce_url
|
||||||
$cookie = undef
|
|
||||||
} else {
|
} else {
|
||||||
$jce_download = $version ? {
|
fail('JCE URL must be specified')
|
||||||
'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
|
|
||||||
}
|
|
||||||
$cookie = 'gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# determine Oracle Java major and minor version, and installation path
|
# determine Java major and minor version, and installation path
|
||||||
if $version_major and $version_minor {
|
if $version_major and $version_minor {
|
||||||
|
|
||||||
$label = $version_major
|
$label = $version_major
|
||||||
$release_major = $version_major
|
$release_major = $version_major
|
||||||
$release_minor = $version_minor
|
$release_minor = $version_minor
|
||||||
$release_hash = $url_hash
|
|
||||||
|
|
||||||
if $release_major =~ /(\d+)u(\d+)/ {
|
if $release_major =~ /(\d+)u(\d+)/ {
|
||||||
# Required for CentOS systems where Java8 update number is >= 171 to ensure
|
# Required for CentOS systems where Java8 update number is >= 171 to ensure
|
||||||
@@ -143,25 +114,21 @@ define java::oracle (
|
|||||||
$release_major = '6u45'
|
$release_major = '6u45'
|
||||||
$release_minor = 'b06'
|
$release_minor = 'b06'
|
||||||
$install_path = "${java_se}1.6.0_45"
|
$install_path = "${java_se}1.6.0_45"
|
||||||
$release_hash = undef
|
|
||||||
}
|
}
|
||||||
'7' : {
|
'7' : {
|
||||||
$release_major = '7u80'
|
$release_major = '7u80'
|
||||||
$release_minor = 'b15'
|
$release_minor = 'b15'
|
||||||
$install_path = "${java_se}1.7.0_80"
|
$install_path = "${java_se}1.7.0_80"
|
||||||
$release_hash = undef
|
|
||||||
}
|
}
|
||||||
'8' : {
|
'8' : {
|
||||||
$release_major = '8u201'
|
$release_major = '8u201'
|
||||||
$release_minor = 'b09'
|
$release_minor = 'b09'
|
||||||
$install_path = "${java_se}1.8.0_201"
|
$install_path = "${java_se}1.8.0_201"
|
||||||
$release_hash = '42970487e3af4f5aa5bca3f542482c60'
|
|
||||||
}
|
}
|
||||||
default : {
|
default : {
|
||||||
$release_major = '8u201'
|
$release_major = '8u201'
|
||||||
$release_minor = 'b09'
|
$release_minor = 'b09'
|
||||||
$install_path = "${java_se}1.8.0_201"
|
$install_path = "${java_se}1.8.0_201"
|
||||||
$release_hash = '42970487e3af4f5aa5bca3f542482c60'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +202,7 @@ define java::oracle (
|
|||||||
# JaveSE 6 distributed in .bin format
|
# JaveSE 6 distributed in .bin format
|
||||||
# http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-i586-rpm.bin
|
# http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-i586-rpm.bin
|
||||||
# http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-i586.bin
|
# http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-i586.bin
|
||||||
# package name to download from Oracle's website
|
# package name to use in destination directory for the installer
|
||||||
case $_package_type {
|
case $_package_type {
|
||||||
'bin' : {
|
'bin' : {
|
||||||
$package_name = "${java_se}-${release_major}-${os}-${arch}.bin"
|
$package_name = "${java_se}-${release_major}-${os}-${arch}.bin"
|
||||||
@@ -258,11 +225,8 @@ define java::oracle (
|
|||||||
if $url {
|
if $url {
|
||||||
$source = $url
|
$source = $url
|
||||||
}
|
}
|
||||||
elsif $release_hash != undef {
|
|
||||||
$source = "${oracle_url}/${release_major}-${release_minor}/${release_hash}/${package_name}"
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
$source = "${oracle_url}/${release_major}-${release_minor}/${package_name}"
|
fail('Url must be specified')
|
||||||
}
|
}
|
||||||
|
|
||||||
# full path to the installer
|
# full path to the installer
|
||||||
@@ -292,7 +256,6 @@ define java::oracle (
|
|||||||
archive { $destination :
|
archive { $destination :
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => $source,
|
source => $source,
|
||||||
cookie => 'gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie',
|
|
||||||
extract_path => '/tmp',
|
extract_path => '/tmp',
|
||||||
cleanup => false,
|
cleanup => false,
|
||||||
creates => $creates_path,
|
creates => $creates_path,
|
||||||
@@ -339,7 +302,6 @@ define java::oracle (
|
|||||||
}
|
}
|
||||||
archive { "/tmp/jce-${version}.zip":
|
archive { "/tmp/jce-${version}.zip":
|
||||||
source => $jce_download,
|
source => $jce_download,
|
||||||
cookie => $cookie,
|
|
||||||
extract => true,
|
extract => true,
|
||||||
extract_path => $jce_path,
|
extract_path => $jce_path,
|
||||||
extract_flags => '-oj',
|
extract_flags => '-oj',
|
||||||
@@ -73,36 +73,8 @@ class java::params {
|
|||||||
'armv7l' => 'armhf',
|
'armv7l' => 'armhf',
|
||||||
default => $::architecture
|
default => $::architecture
|
||||||
}
|
}
|
||||||
case $::lsbdistcodename {
|
case $::operatingsystemmajrelease {
|
||||||
'lenny', 'squeeze', 'lucid', 'natty': {
|
'7', '8', '14.04': {
|
||||||
$java = {
|
|
||||||
'jdk' => {
|
|
||||||
'package' => 'openjdk-6-jdk',
|
|
||||||
'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-${openjdk_architecture}",
|
|
||||||
'alternative_path' => '/usr/lib/jvm/java-6-openjdk/jre/bin/java',
|
|
||||||
'java_home' => '/usr/lib/jvm/java-6-openjdk/jre/',
|
|
||||||
},
|
|
||||||
'sun-jre' => {
|
|
||||||
'package' => 'sun-java6-jre',
|
|
||||||
'alternative' => 'java-6-sun',
|
|
||||||
'alternative_path' => '/usr/lib/jvm/java-6-sun/jre/bin/java',
|
|
||||||
'java_home' => '/usr/lib/jvm/java-6-sun/jre/',
|
|
||||||
},
|
|
||||||
'sun-jdk' => {
|
|
||||||
'package' => 'sun-java6-jdk',
|
|
||||||
'alternative' => 'java-6-sun',
|
|
||||||
'alternative_path' => '/usr/lib/jvm/java-6-sun/jre/bin/java',
|
|
||||||
'java_home' => '/usr/lib/jvm/java-6-sun/jre/',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'wheezy', 'jessie', 'precise', 'quantal', 'raring', 'saucy', 'trusty', 'utopic': {
|
|
||||||
$java = {
|
$java = {
|
||||||
'jdk' => {
|
'jdk' => {
|
||||||
'package' => 'openjdk-7-jdk',
|
'package' => 'openjdk-7-jdk',
|
||||||
@@ -154,7 +126,7 @@ class java::params {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful': {
|
'9', '15.04', '15.10', '16.04', '16.10', '17.04', '17.10': {
|
||||||
$java = {
|
$java = {
|
||||||
'jdk' => {
|
'jdk' => {
|
||||||
'package' => 'openjdk-8-jdk',
|
'package' => 'openjdk-8-jdk',
|
||||||
@@ -170,7 +142,7 @@ class java::params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'bionic': {
|
'10', '18.04', '18.10', '19.04', '19.10': {
|
||||||
$java = {
|
$java = {
|
||||||
'jdk' => {
|
'jdk' => {
|
||||||
'package' => 'openjdk-11-jdk',
|
'package' => 'openjdk-11-jdk',
|
||||||
@@ -186,7 +158,7 @@ class java::params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: { fail("unsupported release ${::lsbdistcodename}") }
|
default: { fail("unsupported release ${::operatingsystemmajrelease}") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'OpenBSD': {
|
'OpenBSD': {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "puppetlabs-java",
|
"name": "puppetlabs-java",
|
||||||
"version": "4.1.0",
|
"version": "5.0.1",
|
||||||
"author": "puppetlabs",
|
"author": "puppetlabs",
|
||||||
"summary": "Installs the correct Java package on various platforms.",
|
"summary": "Installs the correct Java package on various platforms.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
"version_requirement": ">= 5.5.10 < 7.0.0"
|
"version_requirement": ">= 5.5.10 < 7.0.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"template-url": "https://github.com/puppetlabs/pdk-templates#master",
|
"template-url": "https://github.com/puppetlabs/pdk-templates/#master",
|
||||||
"template-ref": "heads/master-0-gf778803",
|
"template-ref": "heads/master-0-gb096033",
|
||||||
"pdk-version": "1.10.0"
|
"pdk-version": "1.11.1"
|
||||||
}
|
}
|
||||||
|
|||||||
13
provision.yaml
Normal file
13
provision.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
default:
|
||||||
|
provisioner: docker
|
||||||
|
images: ['waffleimage/debian8']
|
||||||
|
travis_deb:
|
||||||
|
provisioner: docker
|
||||||
|
images: ['debian:8', 'debian:9', 'ubuntu:14.04', 'ubuntu:16.04', 'ubuntu:18.04']
|
||||||
|
travis_el:
|
||||||
|
provisioner: docker_exp
|
||||||
|
images: ['centos:6', 'centos:7', 'oraclelinux:6', 'oraclelinux:7', 'scientificlinux/sl:6', 'scientificlinux/sl:7']
|
||||||
|
release_checks:
|
||||||
|
provisioner: vmpooler
|
||||||
|
images: ['redhat-6-x86_64', 'redhat-7-x86_64', 'redhat-8-x86_64', 'centos-6-x86_64', 'centos-7-x86_64', 'oracle-6-x86_64', 'oracle-7-x86_64', 'scientific-6-x86_64', 'scientific-7-x86_64', 'debian-8-x86_64', 'debian-9-x86_64', 'ubuntu-1404-x86_64', 'ubuntu-1604-x86_64', 'ubuntu-1804-x86_64', 'sles-11-x86_64', 'sles-12-x86_64', 'sles-15-x86_64']
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
include Unix::File
|
|
||||||
|
|
||||||
java_class_jre = "class { 'java':\n"\
|
java_class_jre = "class { 'java':\n"\
|
||||||
" distribution => 'jre',\n"\
|
" distribution => 'jre',\n"\
|
||||||
'}'
|
'}'
|
||||||
@@ -22,14 +20,6 @@ _sun_jdk = "class { 'java':\n"\
|
|||||||
" distribution => 'sun-jdk',\n"\
|
" distribution => 'sun-jdk',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
oracle_jre = "class { 'java':\n"\
|
|
||||||
" distribution => 'oracle-jre',\n"\
|
|
||||||
'}'
|
|
||||||
|
|
||||||
oracle_jdk = "class { 'java':\n"\
|
|
||||||
" distribution => 'oracle-jdk',\n"\
|
|
||||||
'}'
|
|
||||||
|
|
||||||
blank_version = "class { 'java':\n"\
|
blank_version = "class { 'java':\n"\
|
||||||
" version => '',\n"\
|
" version => '',\n"\
|
||||||
'}'
|
'}'
|
||||||
@@ -51,88 +41,15 @@ bogus_alternative = "class { 'java':\n"\
|
|||||||
" java_alternative_path => '/whatever',\n"\
|
" java_alternative_path => '/whatever',\n"\
|
||||||
'}'
|
'}'
|
||||||
|
|
||||||
# Oracle installs are disabled by default, because the links to valid oracle installations
|
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
# 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 = '201'
|
|
||||||
oracle_version_build = '09'
|
|
||||||
oracle_hash = '42970487e3af4f5aa5bca3f542482c60'
|
|
||||||
|
|
||||||
install_oracle_jdk_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',
|
|
||||||
}
|
|
||||||
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
|
it 'installs jre' do
|
||||||
idempotent_apply(default, java_class_jre)
|
idempotent_apply(java_class_jre)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
it 'installs jdk' do
|
it 'installs jdk' do
|
||||||
idempotent_apply(default, java_class)
|
idempotent_apply(java_class)
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'oracle', if: (
|
|
||||||
(fact('operatingsystem') == 'Ubuntu') && fact('operatingsystemrelease').match(%r{^14\.04})
|
|
||||||
) do
|
|
||||||
# not supported
|
|
||||||
# The package is not available from any sources, but if a customer
|
|
||||||
# custom-builds the package using java-package and adds it to a local
|
|
||||||
# repository, that is the intention of this version ability
|
|
||||||
describe 'jre' do
|
|
||||||
it 'installs oracle-jre' do
|
|
||||||
apply_manifest(oracle_jre, expect_failures: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
describe 'jdk' do
|
|
||||||
it 'installs oracle-jdk' do
|
|
||||||
apply_manifest(oracle_jdk, expect_failures: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -154,40 +71,10 @@ context 'with failure cases' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'fails on debian or RHEL when passed fake java_alternative and path' do
|
it 'fails on debian or RHEL when passed fake java_alternative and path' do
|
||||||
if fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat'
|
if os[:family] == 'debian' || os[:family] == 'redhat'
|
||||||
apply_manifest(bogus_alternative, expect_failures: true)
|
apply_manifest(bogus_alternative, expect_failures: true)
|
||||||
else
|
else
|
||||||
apply_manifest(bogus_alternative, catch_failures: true)
|
apply_manifest(bogus_alternative, catch_failures: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
|
||||||
let(:install_path) do
|
|
||||||
(fact('osfamily') == 'RedHat') ? '/usr/java' : '/usr/lib/jvm'
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:version_suffix) do
|
|
||||||
(fact('osfamily') == 'RedHat') ? '-amd64' : ''
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'installs oracle jdk and jre' do
|
|
||||||
idempotent_apply(default, install_oracle_jdk_jre)
|
|
||||||
jdk_result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
|
|
||||||
jre_result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
|
|
||||||
expect(jdk_result.exit_code).to eq(0)
|
|
||||||
expect(jre_result.exit_code).to eq(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'installs oracle jdk with jce' do
|
|
||||||
idempotent_apply(default, install_oracle_jdk_jce)
|
|
||||||
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
|
|
||||||
idempotent_apply(default, install_oracle_jre_jce)
|
|
||||||
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
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
centos-7-x64:
|
|
||||||
roles:
|
|
||||||
- agent
|
|
||||||
- default
|
|
||||||
platform: el-7-x86_64
|
|
||||||
hypervisor: vagrant
|
|
||||||
box: puppetlabs/centos-7.2-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
debian-8-x64:
|
|
||||||
roles:
|
|
||||||
- agent
|
|
||||||
- default
|
|
||||||
platform: debian-8-amd64
|
|
||||||
hypervisor: vagrant
|
|
||||||
box: puppetlabs/debian-8.2-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
roles:
|
|
||||||
- agent
|
|
||||||
- default
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor: vagrant
|
|
||||||
box: puppetlabs/ubuntu-14.04-64-nocm
|
|
||||||
CONFIG:
|
|
||||||
type: foss
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
centos-7-x64:
|
|
||||||
platform: el-7-x86_64
|
|
||||||
hypervisor: docker
|
|
||||||
image: centos:7
|
|
||||||
docker_preserve_image: true
|
|
||||||
docker_cmd: '["/usr/sbin/init"]'
|
|
||||||
# install various tools required to get the image up to usable levels
|
|
||||||
docker_image_commands:
|
|
||||||
- 'yum install -y crontabs tar wget openssl sysvinit-tools iproute which initscripts'
|
|
||||||
CONFIG:
|
|
||||||
trace_limit: 200
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
debian-8-x64:
|
|
||||||
platform: debian-8-amd64
|
|
||||||
hypervisor: docker
|
|
||||||
image: debian:8
|
|
||||||
docker_preserve_image: true
|
|
||||||
docker_cmd: '["/sbin/init"]'
|
|
||||||
docker_image_commands:
|
|
||||||
- 'apt-get update && apt-get install -y net-tools wget locales strace lsof && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen'
|
|
||||||
CONFIG:
|
|
||||||
trace_limit: 200
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
HOSTS:
|
|
||||||
ubuntu-1404-x64:
|
|
||||||
platform: ubuntu-14.04-amd64
|
|
||||||
hypervisor: docker
|
|
||||||
image: ubuntu:14.04
|
|
||||||
docker_preserve_image: true
|
|
||||||
docker_cmd: '["/sbin/init"]'
|
|
||||||
docker_image_commands:
|
|
||||||
# ensure that upstart is booting correctly in the container
|
|
||||||
- 'rm /usr/sbin/policy-rc.d && rm /sbin/initctl && dpkg-divert --rename --remove /sbin/initctl && apt-get update && apt-get install -y net-tools wget && locale-gen en_US.UTF-8'
|
|
||||||
CONFIG:
|
|
||||||
trace_limit: 200
|
|
||||||
@@ -54,7 +54,7 @@ describe 'java', type: :class do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when select jdk for Ubuntu Trusty (14.04)' do
|
context 'when select jdk for Ubuntu Trusty (14.04)' do
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'trusty', operatingsystemrelease: '14.04', architecture: 'amd64' } }
|
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'trusty', operatingsystemmajrelease: '14.04', architecture: 'amd64' } }
|
||||||
let(:params) { { 'distribution' => 'jdk' } }
|
let(:params) { { 'distribution' => 'jdk' } }
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
||||||
@@ -62,7 +62,7 @@ describe 'java', type: :class do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when select jre for Ubuntu Trusty (14.04)' do
|
context 'when select jre for Ubuntu Trusty (14.04)' do
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'trusty', operatingsystemrelease: '14.04', architecture: 'amd64' } }
|
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'trusty', operatingsystemmajrelease: '14.04', architecture: 'amd64' } }
|
||||||
let(:params) { { 'distribution' => 'jre' } }
|
let(:params) { { 'distribution' => 'jre' } }
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') }
|
it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') }
|
||||||
@@ -70,7 +70,7 @@ describe 'java', type: :class do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when select jdk for Ubuntu xenial (16.04) on ARM' do
|
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(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemmajrelease: '16.04', architecture: 'armv7l' } }
|
||||||
let(:params) { { 'distribution' => 'jdk' } }
|
let(:params) { { 'distribution' => 'jdk' } }
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
||||||
@@ -78,7 +78,7 @@ describe 'java', type: :class do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when select jdk for Ubuntu xenial (16.04) on ARM64' do
|
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(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'xenial', operatingsystemmajrelease: '16.04', architecture: 'aarch64' } }
|
||||||
let(:params) { { 'distribution' => 'jdk' } }
|
let(:params) { { 'distribution' => 'jdk' } }
|
||||||
|
|
||||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
||||||
@@ -156,7 +156,7 @@ describe 'java', type: :class do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'custom java package' do
|
describe 'custom java package' do
|
||||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'jessie', operatingsystemrelease: '8.6', architecture: 'amd64' } }
|
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'jessie', operatingsystemmajrelease: '8', architecture: 'amd64' } }
|
||||||
|
|
||||||
context 'when all params provided' do
|
context 'when all params provided' do
|
||||||
let(:params) do
|
let(:params) do
|
||||||
|
|||||||
131
spec/defines/download_spec.rb
Normal file
131
spec/defines/download_spec.rb
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
url = 'http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz'
|
||||||
|
|
||||||
|
describe 'java::download', type: :define do
|
||||||
|
context 'with CentOS 64-bit' do
|
||||||
|
let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } }
|
||||||
|
|
||||||
|
context 'when passing URL to url parameter' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
ensure: 'present',
|
||||||
|
version_major: '8u201',
|
||||||
|
version_minor: 'b09',
|
||||||
|
java_se: 'jdk',
|
||||||
|
url: $url,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:title) { 'jdk8' }
|
||||||
|
|
||||||
|
it {
|
||||||
|
is_expected.to contain_archive('/tmp/jdk-8u201-linux-x64.rpm')
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when no url provided' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
ensure: 'present',
|
||||||
|
version_major: '8u201',
|
||||||
|
version_minor: 'b09',
|
||||||
|
java_se: 'jdk',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:title) { 'jdk8' }
|
||||||
|
|
||||||
|
it {
|
||||||
|
is_expected.to raise_error Puppet::Error
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when manage_symlink is set to true' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
ensure: 'present',
|
||||||
|
version: '6',
|
||||||
|
java_se: 'jdk',
|
||||||
|
basedir: '/usr/java',
|
||||||
|
manage_symlink: true,
|
||||||
|
symlink_name: 'java_home',
|
||||||
|
url: $url,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:title) { 'jdk6' }
|
||||||
|
|
||||||
|
it { is_expected.to contain_file('/usr/java/java_home') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with Ubuntu 64-bit' do
|
||||||
|
let(:facts) { { kernel: 'Linux', os: { family: 'Debian', architecture: 'amd64', name: 'Ubuntu', release: { full: '16.04' } } } }
|
||||||
|
|
||||||
|
context 'when passing URL to url parameter' do
|
||||||
|
let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: $url } }
|
||||||
|
let(:title) { 'jdk8' }
|
||||||
|
|
||||||
|
it { is_expected.to contain_archive('/tmp/jdk-8u201-linux-x64.tar.gz') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe 'incompatible OSes' do
|
||||||
|
[
|
||||||
|
{
|
||||||
|
kernel: 'Windows',
|
||||||
|
os: {
|
||||||
|
family: 'Windows',
|
||||||
|
name: 'Windows',
|
||||||
|
release: {
|
||||||
|
full: '8.1',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kernel: 'Darwin',
|
||||||
|
os: {
|
||||||
|
family: 'Darwin',
|
||||||
|
name: 'Darwin',
|
||||||
|
release: {
|
||||||
|
full: '13.3.0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kernel: 'AIX',
|
||||||
|
os: {
|
||||||
|
family: 'AIX',
|
||||||
|
name: 'AIX',
|
||||||
|
release: {
|
||||||
|
full: '7100-02-00-000',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kernel: 'AIX',
|
||||||
|
os: {
|
||||||
|
family: 'AIX',
|
||||||
|
name: 'AIX',
|
||||||
|
release: {
|
||||||
|
full: '6100-07-04-1216',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kernel: 'AIX',
|
||||||
|
os: {
|
||||||
|
family: 'AIX',
|
||||||
|
name: 'AIX',
|
||||||
|
release: {
|
||||||
|
full: '5300-12-01-1016',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
].each do |facts|
|
||||||
|
let(:facts) { facts }
|
||||||
|
let(:title) { 'jdk' }
|
||||||
|
|
||||||
|
it "is_expected.to fail on #{facts[:os][:name]} #{facts[:os][:release][:full]}" do
|
||||||
|
expect { catalogue }.to raise_error Puppet::Error, %r{unsupported platform}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,474 +0,0 @@
|
|||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
oracle_url = 'http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz'
|
|
||||||
|
|
||||||
describe 'java::oracle', type: :define do
|
|
||||||
context 'with CentOS 64-bit' do
|
|
||||||
let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'x86_64', name: 'CentOS', release: { full: '6.0' } } } }
|
|
||||||
|
|
||||||
context 'when Oracle Java SE 6 JDK' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jdk' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jdk' } }
|
|
||||||
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 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-8u201-linux-x64.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').with_command('rpm --force -iv /tmp/jdk-8u201-linux-x64.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').that_requires('Archive[/tmp/jdk-8u201-linux-x64.rpm]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when Oracle Java SE 6 JRE' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jre' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jre' } }
|
|
||||||
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 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-8u201-linux-x64.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').with_command('rpm --force -iv /tmp/jre-8u201-linux-x64.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').that_requires('Archive[/tmp/jre-8u201-linux-x64.rpm]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when passing URL to url parameter' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version_major: '8u201',
|
|
||||||
version_minor: 'b09',
|
|
||||||
java_se: 'jdk',
|
|
||||||
url: 'http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm',
|
|
||||||
url_hash: 'ignored',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
let(:title) { 'jdk8' }
|
|
||||||
|
|
||||||
it {
|
|
||||||
is_expected.to contain_archive('/tmp/jdk-8u201-linux-x64.rpm')
|
|
||||||
.with_source('http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm')
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when passing a hash to url_hash parameter' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version_major: '8u201',
|
|
||||||
version_minor: 'b09',
|
|
||||||
java_se: 'jdk',
|
|
||||||
url_hash: '42970487e3af4f5aa5bca3f542482c60',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
let(:title) { 'jdk8' }
|
|
||||||
|
|
||||||
it {
|
|
||||||
is_expected.to contain_archive('/tmp/jdk-8u201-linux-x64.rpm')
|
|
||||||
.with_source('http://download.oracle.com/otn-pub/java/jdk//8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm')
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when installing multiple versions' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version_major: '8u201',
|
|
||||||
version_minor: 'b09',
|
|
||||||
java_se: 'jdk',
|
|
||||||
url_hash: '42970487e3af4f5aa5bca3f542482c60',
|
|
||||||
}
|
|
||||||
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
|
|
||||||
|
|
||||||
context 'when specifying package_type tar.gz and basedir' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version: '6',
|
|
||||||
java_se: 'jdk',
|
|
||||||
basedir: '/usr/java',
|
|
||||||
package_type: 'tar.gz',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
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 6u45 b06').with_command('tar -zxf /tmp/jdk-6u45-linux-x64.tar.gz -C /usr/java') }
|
|
||||||
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 'when manage_basedir is set to true' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version: '6',
|
|
||||||
java_se: 'jdk',
|
|
||||||
basedir: '/usr/java',
|
|
||||||
manage_basedir: true,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
let(:title) { 'jdk6' }
|
|
||||||
|
|
||||||
it { is_expected.to contain_file('/usr/java') }
|
|
||||||
end
|
|
||||||
context 'when manage_symlink is set to true' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version: '6',
|
|
||||||
java_se: 'jdk',
|
|
||||||
basedir: '/usr/java',
|
|
||||||
manage_symlink: true,
|
|
||||||
symlink_name: 'java_home',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
let(:title) { 'jdk6' }
|
|
||||||
|
|
||||||
it { is_expected.to contain_file('/usr/java/java_home') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when on CentOS 32-bit' do
|
|
||||||
let(:facts) { { kernel: 'Linux', os: { family: 'RedHat', architecture: 'i386', name: 'CentOS', release: { full: '6.6' } } } }
|
|
||||||
|
|
||||||
context 'when selecting Oracle Java SE 6 JDK on RedHat family, 32-bit' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jdk' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jdk' } }
|
|
||||||
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 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-8u201-linux-i586.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').with_command('rpm --force -iv /tmp/jdk-8u201-linux-i586.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').that_requires('Archive[/tmp/jdk-8u201-linux-i586.rpm]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when selecting Oracle Java SE 6 JRE on RedHat family, 32-bit' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jre' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jre' } }
|
|
||||||
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 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-8u201-linux-i586.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').with_command('rpm --force -iv /tmp/jre-8u201-linux-i586.rpm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').that_requires('Archive[/tmp/jre-8u201-linux-i586.rpm]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when installing multiple versions' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version_major: '8u201',
|
|
||||||
version_minor: 'b09',
|
|
||||||
java_se: 'jdk',
|
|
||||||
url_hash: '42970487e3af4f5aa5bca3f542482c60',
|
|
||||||
}
|
|
||||||
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
|
|
||||||
|
|
||||||
context 'with Ubuntu 64-bit' do
|
|
||||||
let(:facts) { { kernel: 'Linux', os: { family: 'Debian', architecture: 'amd64', name: 'Ubuntu', release: { full: '16.04' } } } }
|
|
||||||
|
|
||||||
context 'when Oracle Java SE 6 JDK' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jdk' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jdk' } }
|
|
||||||
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 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-8u201-linux-x64.tar.gz') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').with_command('tar -zxf /tmp/jdk-8u201-linux-x64.tar.gz -C /usr/lib/jvm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jdk 8 8u201 b09').that_requires('Archive[/tmp/jdk-8u201-linux-x64.tar.gz]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with Oracle Java SE 6 JRE' do
|
|
||||||
let(:params) { { ensure: 'present', version: '6', java_se: 'jre' } }
|
|
||||||
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 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
|
|
||||||
let(:params) { { ensure: 'present', version: '7', java_se: 'jre' } }
|
|
||||||
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 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-8u201-linux-x64.tar.gz') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').with_command('tar -zxf /tmp/jre-8u201-linux-x64.tar.gz -C /usr/lib/jvm') }
|
|
||||||
it { is_expected.to contain_exec('Install Oracle java_se jre 8 8u201 b09').that_requires('Archive[/tmp/jre-8u201-linux-x64.tar.gz]') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when passing URL to url parameter' do
|
|
||||||
let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: oracle_url.to_s } }
|
|
||||||
let(:title) { 'jdk8' }
|
|
||||||
|
|
||||||
it { is_expected.to contain_archive('/tmp/jdk-8u201-linux-x64.tar.gz') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when installing multiple versions' do
|
|
||||||
let(:params) do
|
|
||||||
{
|
|
||||||
ensure: 'present',
|
|
||||||
version_major: '8u201',
|
|
||||||
version_minor: 'b09',
|
|
||||||
java_se: 'jdk',
|
|
||||||
url_hash: '42970487e3af4f5aa5bca3f542482c60',
|
|
||||||
}
|
|
||||||
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
|
|
||||||
[
|
|
||||||
{
|
|
||||||
kernel: 'Windows',
|
|
||||||
os: {
|
|
||||||
family: 'Windows',
|
|
||||||
name: 'Windows',
|
|
||||||
release: {
|
|
||||||
full: '8.1',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kernel: 'Darwin',
|
|
||||||
os: {
|
|
||||||
family: 'Darwin',
|
|
||||||
name: 'Darwin',
|
|
||||||
release: {
|
|
||||||
full: '13.3.0',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kernel: 'AIX',
|
|
||||||
os: {
|
|
||||||
family: 'AIX',
|
|
||||||
name: 'AIX',
|
|
||||||
release: {
|
|
||||||
full: '7100-02-00-000',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kernel: 'AIX',
|
|
||||||
os: {
|
|
||||||
family: 'AIX',
|
|
||||||
name: 'AIX',
|
|
||||||
release: {
|
|
||||||
full: '6100-07-04-1216',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kernel: 'AIX',
|
|
||||||
os: {
|
|
||||||
family: 'AIX',
|
|
||||||
name: 'AIX',
|
|
||||||
release: {
|
|
||||||
full: '5300-12-01-1016',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
].each do |facts|
|
|
||||||
let(:facts) { facts }
|
|
||||||
let(:title) { 'jdk' }
|
|
||||||
|
|
||||||
it "is_expected.to fail on #{facts[:os][:name]} #{facts[:os][:release][:full]}" do
|
|
||||||
expect { catalogue }.to raise_error Puppet::Error, %r{unsupported platform}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -29,6 +29,11 @@ default_fact_files.each do |f|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# read default_facts and merge them over what is provided by facterdb
|
||||||
|
default_facts.each do |fact, value|
|
||||||
|
add_custom_fact fact, value
|
||||||
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
c.default_facts = default_facts
|
c.default_facts = default_facts
|
||||||
c.before :each do
|
c.before :each do
|
||||||
@@ -42,6 +47,8 @@ RSpec.configure do |c|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Ensures that a module is defined
|
||||||
|
# @param module_name Name of the module
|
||||||
def ensure_module_defined(module_name)
|
def ensure_module_defined(module_name)
|
||||||
module_name.split('::').reduce(Object) do |last_module, next_module|
|
module_name.split('::').reduce(Object) do |last_module, next_module|
|
||||||
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
|
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
|
||||||
|
|||||||
@@ -1,37 +1,59 @@
|
|||||||
require 'beaker-pe'
|
# frozen_string_literal: true
|
||||||
require 'beaker-puppet'
|
|
||||||
require 'beaker-rspec'
|
|
||||||
require 'beaker/puppet_install_helper'
|
|
||||||
require 'beaker/module_install_helper'
|
|
||||||
|
|
||||||
run_puppet_install_helper
|
require 'serverspec'
|
||||||
configure_type_defaults_on(hosts)
|
require 'puppet_litmus'
|
||||||
install_module_on(hosts)
|
require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))
|
||||||
install_module_dependencies_on(hosts)
|
include PuppetLitmus
|
||||||
|
|
||||||
UNSUPPORTED_PLATFORMS = ['Darwin', 'windows'].freeze
|
if ENV['TARGET_HOST'].nil? || ENV['TARGET_HOST'] == 'localhost'
|
||||||
|
puts 'Running tests against this machine !'
|
||||||
|
if Gem.win_platform?
|
||||||
|
set :backend, :cmd
|
||||||
|
else
|
||||||
|
set :backend, :exec
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# load inventory
|
||||||
|
inventory_hash = inventory_hash_from_inventory_file
|
||||||
|
node_config = config_from_node(inventory_hash, ENV['TARGET_HOST'])
|
||||||
|
|
||||||
unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no'
|
if target_in_group(inventory_hash, ENV['TARGET_HOST'], 'docker_nodes')
|
||||||
hosts.each do |host|
|
host = ENV['TARGET_HOST']
|
||||||
install_puppet_module_via_pmt_on(host, module_name: 'puppetlabs-apt')
|
set :backend, :docker
|
||||||
end
|
set :docker_container, host
|
||||||
end
|
elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'ssh_nodes')
|
||||||
|
set :backend, :ssh
|
||||||
RSpec.configure do |c|
|
options = Net::SSH::Config.for(host)
|
||||||
# Readable test descriptions
|
options[:user] = node_config.dig('ssh', 'user') unless node_config.dig('ssh', 'user').nil?
|
||||||
c.formatter = :documentation
|
options[:port] = node_config.dig('ssh', 'port') unless node_config.dig('ssh', 'port').nil?
|
||||||
end
|
options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil?
|
||||||
|
options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil?
|
||||||
def idempotent_apply(hosts, manifest, opts = {}, &block)
|
options[:verify_host_key] = Net::SSH::Verifiers::Null.new unless node_config.dig('ssh', 'host-key-check').nil?
|
||||||
block_on hosts, opts do |host|
|
host = if ENV['TARGET_HOST'].include?(':')
|
||||||
file_path = host.tmpfile('apply_manifest.pp')
|
ENV['TARGET_HOST'].split(':').first
|
||||||
create_remote_file(host, file_path, manifest + "\n")
|
else
|
||||||
|
ENV['TARGET_HOST']
|
||||||
puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil }
|
end
|
||||||
on_options = { acceptable_exit_codes: [0, 2] }
|
set :host, options[:host_name] || host
|
||||||
on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block
|
set :ssh_options, options
|
||||||
puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil }
|
set :request_pty, true
|
||||||
on_options2 = { acceptable_exit_codes: [0] }
|
elsif target_in_group(inventory_hash, ENV['TARGET_HOST'], 'winrm_nodes')
|
||||||
on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block
|
require 'winrm'
|
||||||
|
|
||||||
|
set :backend, :winrm
|
||||||
|
set :os, family: 'windows'
|
||||||
|
user = node_config.dig('winrm', 'user') unless node_config.dig('winrm', 'user').nil?
|
||||||
|
pass = node_config.dig('winrm', 'password') unless node_config.dig('winrm', 'password').nil?
|
||||||
|
endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
user: user,
|
||||||
|
password: pass,
|
||||||
|
endpoint: endpoint,
|
||||||
|
operation_timeout: 300,
|
||||||
|
}
|
||||||
|
|
||||||
|
winrm = WinRM::Connection.new opts
|
||||||
|
Specinfra.configuration.winrm = winrm
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
1
spec/spec_helper_acceptance_local.rb
Normal file
1
spec/spec_helper_acceptance_local.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
UNSUPPORTED_PLATFORMS = ['darwin', 'windows'].freeze
|
||||||
Reference in New Issue
Block a user