Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a65d69a85d | ||
|
|
1c1d0b6cb7 | ||
|
|
faede8c802 | ||
|
|
a9198d235d | ||
|
|
c47711e36e | ||
|
|
65476bd54b | ||
|
|
8eee08c143 | ||
|
|
dadc7a6c22 | ||
|
|
3645364e5b | ||
|
|
913a810bfd | ||
|
|
8bef423733 | ||
|
|
abd490dc6a | ||
|
|
7c70ceaed7 | ||
|
|
76c5d2c93d | ||
|
|
8e5b079fd7 | ||
|
|
e8b3dd534f | ||
|
|
9efcb78c1f | ||
|
|
d07a3551c7 | ||
|
|
911b497725 | ||
|
|
9e85843369 | ||
|
|
b04fbac5af | ||
|
|
17dfb850db | ||
|
|
b058ce725c | ||
|
|
cf0c56b06f | ||
|
|
3a102bcde4 | ||
|
|
907e727ad1 | ||
|
|
14cf5c4e5d | ||
|
|
4aac413e04 | ||
|
|
a64efdff6e | ||
|
|
bfc03a54c5 | ||
|
|
75fa927d72 | ||
|
|
a5500ff58e | ||
|
|
ec66670995 | ||
|
|
079c963e05 | ||
|
|
ba817d0d56 | ||
|
|
42580b0121 | ||
|
|
232258f290 | ||
|
|
0f194c7bb3 | ||
|
|
15909c4186 | ||
|
|
461209338f | ||
|
|
d1f6438adc | ||
|
|
0c73b6242b | ||
|
|
d5aec12518 | ||
|
|
5815242f8e | ||
|
|
586195d6c9 | ||
|
|
e22aa3a36a | ||
|
|
1b9bb75de8 | ||
|
|
868fd0b920 | ||
|
|
0fa3f1a775 | ||
|
|
8db7120eed | ||
|
|
44a1992e83 | ||
|
|
d0a03f66c7 | ||
|
|
ce5529a03d | ||
|
|
5b45d1fede | ||
|
|
7a39d596bd | ||
|
|
75fb20d0eb | ||
|
|
87ac311761 | ||
|
|
412f80a7ba | ||
|
|
9861651c02 | ||
|
|
8dd715a599 | ||
|
|
97b48f12d1 | ||
|
|
1a53dd3ff4 | ||
|
|
79805000cc | ||
|
|
3124798492 | ||
|
|
65010255b6 | ||
|
|
98447f03e7 | ||
|
|
b01d529af3 |
@@ -1,5 +1,5 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
stdlib: http://github.com/puppetlabs/puppetlabs-stdlib.git
|
||||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
symlinks:
|
||||
java: "#{source_dir}"
|
||||
|
||||
7
.sync.yml
Normal file
7
.sync.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
.travis.yml:
|
||||
extras:
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
15
.travis.yml
15
.travis.yml
@@ -1,17 +1,24 @@
|
||||
---
|
||||
sudo: false
|
||||
language: ruby
|
||||
bundler_args: --without system_tests
|
||||
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
||||
- rvm: 2.1.5
|
||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
||||
- rvm: 2.1.5
|
||||
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
|
||||
- rvm: 2.1.6
|
||||
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
|
||||
- rvm: 1.8.7
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 3.0"
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,3 +1,41 @@
|
||||
## Supported Release 1.4.3
|
||||
###Summary
|
||||
|
||||
Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
|
||||
|
||||
## 2015-10-07 - Supported Release 1.4.2
|
||||
### Summary
|
||||
This release fixes the fact to not trigger java every time on OS X when it is not available.
|
||||
|
||||
#### Bugfixes
|
||||
- Causes java\_version fact to not run `java` when java is not installed on OS X
|
||||
|
||||
## 2015-07-16 - Supported Release 1.4.1
|
||||
### Summary
|
||||
This release updates the metadata for the upcoming release of PE and update params for OEL to match metadata
|
||||
|
||||
#### Bugfixes:
|
||||
- Add missing OEL to params
|
||||
|
||||
##2015-07-07 - Supported Release 1.4.0
|
||||
###Summary
|
||||
This release adds several new features, bugfixes, documentation updates, and test improvements.
|
||||
|
||||
####Features:
|
||||
- Puppet 4 support and testing
|
||||
- Adds support for several Operating Systems
|
||||
- Ubuntu 15.04
|
||||
- OpenBSD 5.6, 5.7
|
||||
- Fedora 20, 21, 22
|
||||
|
||||
####Bugfixes:
|
||||
- Fixes java_version fact to work on large systems. (MODULES-1749)
|
||||
- Improves maintainability of java_version fact.
|
||||
- Fixes java package names on Fedora 21+.
|
||||
- Fixes java install problems on Puppet 3.7.5 - 3.8.1 (PUP-4520)
|
||||
- Fixes create-java-alternatives commands on RedHat distros.
|
||||
- Fixes bug with Debian systems missing java-common package.
|
||||
|
||||
##2015-01-20 - Supported Release 1.3.0
|
||||
###Summary
|
||||
This release adds 3 new facts for determining Java version, adds RHEL alternatives support, adds utopic support, and fixes the flag for `update-java-alternatives` when installed from a headless pacakge.
|
||||
|
||||
26
Gemfile
26
Gemfile
@@ -1,20 +1,38 @@
|
||||
source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||
|
||||
def location_for(place, fake_version = nil)
|
||||
if place =~ /^(git:[^#]*)#(.*)/
|
||||
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
|
||||
elsif place =~ /^file:\/\/(.*)/
|
||||
['>= 0', { :path => File.expand_path($1), :require => false }]
|
||||
else
|
||||
[place, { :require => false }]
|
||||
end
|
||||
end
|
||||
|
||||
group :development, :unit_tests do
|
||||
gem 'rake', :require => false
|
||||
gem 'rspec-puppet', :require => false
|
||||
gem 'rspec-core', '3.1.7', :require => false
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'puppet-lint', :require => false
|
||||
gem 'simplecov', :require => false
|
||||
gem 'puppet_facts', :require => false
|
||||
gem 'json', :require => false
|
||||
end
|
||||
|
||||
group :system_tests do
|
||||
gem 'beaker-rspec', :require => false
|
||||
if beaker_version = ENV['BEAKER_VERSION']
|
||||
gem 'beaker', *location_for(beaker_version)
|
||||
end
|
||||
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
|
||||
gem 'beaker-rspec', *location_for(beaker_rspec_version)
|
||||
else
|
||||
gem 'beaker-rspec', :require => false
|
||||
end
|
||||
gem 'serverspec', :require => false
|
||||
gem 'beaker-puppet_install_helper', :require => false
|
||||
end
|
||||
|
||||
|
||||
|
||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
||||
gem 'facter', facterversion, :require => false
|
||||
else
|
||||
|
||||
@@ -28,11 +28,11 @@ To install the correct Java package on your system, include the `java` class: `i
|
||||
|
||||
The java module installs the correct jdk or jre package on a wide variety of systems. By default, the module will install the jdk package, but you can set different installation parameters as needed. For example, to install jre instead of jdk, you would set the distribution parameter:
|
||||
|
||||
```
|
||||
~~~
|
||||
class { 'java':
|
||||
distribution => 'jre',
|
||||
}
|
||||
```
|
||||
~~~
|
||||
|
||||
##Reference
|
||||
|
||||
@@ -40,27 +40,37 @@ class { 'java':
|
||||
|
||||
####Public classes
|
||||
|
||||
* `java`: This is the module's main class, which installs and manages the Java package.
|
||||
* `java`: Installs and manages the Java package.
|
||||
|
||||
####Private classes
|
||||
|
||||
* `java::params`: Builds a hash of jdk/jre packages for all compatible operating systems.
|
||||
|
||||
* `java::config`: Configures the Java alternatives.
|
||||
|
||||
###Parameters:
|
||||
* `java::params`: Builds a hash of jdk/jre packages for all compatible operating systems.
|
||||
|
||||
The following parameters are available in the java module:
|
||||
####Parameters
|
||||
The following parameters are available in `java`:
|
||||
|
||||
* `distribution`: The Java distribution to install. Can be 'jdk','jre', or, where the platform supports alternative packages, 'sun-jdk', 'sun-jre', 'oracle-jdk', 'oracle-jre'. Defaults to 'jdk'.
|
||||
##### `distribution`
|
||||
Specifies the Java distribution to install.
|
||||
Valid options: 'jdk', 'jre', or, where the platform supports alternative packages, 'sun-jdk', 'sun-jre', 'oracle-jdk', 'oracle-jre'. Default: 'jdk'.
|
||||
|
||||
* `version`: The version of Java to install, if you want to ensure a particular version. By default, the module ensures that Java is present but does not require a specific version.
|
||||
#####`java_alternative`
|
||||
Specifies the name of the Java alternative to use. If you set this parameter, *you must also set the `java_alternative_path`.*
|
||||
Valid options: Run command `update-java-alternatives -l` for a list of available choices. Default: OS and distribution dependent defaults on *deb systems, undef on others.
|
||||
|
||||
* `package`: The name of the Java package. This is configurable in case you want to install a non-standard Java package. If not set, the module will install the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter will do nothing.
|
||||
#####`java_alternative_path`
|
||||
*Required when `java_alternative` is specified.* Defines the path to the `java` command.
|
||||
Valid option: String. Default: OS and distribution dependent defaults on *deb systems, undef on others.
|
||||
|
||||
* `java_alternative`: The name of the Java alternative to use. The command 'update-java-alternatives -l' will show which choices are available. If you specify a particular package, you will usually want to specify which Java alternative to use. If you set this parameter, you also need to set the `java_alternative_path`.
|
||||
#####`package`
|
||||
Specifies the name of the Java package. This is configurable in case you want to install a non-standard Java package. If not set, the module will install the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter will do nothing.
|
||||
Valid option: String. Default: undef.
|
||||
|
||||
#####`version`
|
||||
Sets the version of Java to install, if you want to ensure a particular version.
|
||||
Valid options: 'present', 'installed', 'latest', or a string matching `/^[.+_0-9a-zA-Z:-]+$/`. Default: 'present'.
|
||||
|
||||
* `java_alternative_path`: The path to the 'java' command. Since the alternatives system makes it difficult to verify which alternative is actually enabled, this is required to ensure the correct JVM is enabled.
|
||||
|
||||
###Facts
|
||||
|
||||
@@ -76,11 +86,14 @@ The java module includes a few facts to describe the version of Java installed o
|
||||
|
||||
This module cannot guarantee installation of Java versions that are not available on platform repositories.
|
||||
|
||||
This module only manages a singular installation of Java, meaning it is not possible to manage e.g. OpenJDK 7, Oracle Java 7 and Oracle Java 8 in parallel on the same system.
|
||||
|
||||
Oracle Java packages are not included in Debian 7 and Ubuntu 12.04/14.04 repositories. To install Java on those systems, you'll need to package Oracle JDK/JRE, and then the module will be able to install the package. For more information on how to package Oracle JDK/JRE, see the [Debian wiki](http://wiki.debian.org/JavaPackage).
|
||||
|
||||
This module is officially [supported](https://forge.puppetlabs.com/supported) for the following Java versions and platforms:
|
||||
|
||||
OpenJDK is supported on:
|
||||
OpenJDK is supported on:
|
||||
|
||||
* Red Hat Enterprise Linux (RHEL) 5, 6, 7
|
||||
* CentOS 5, 6, 7
|
||||
* Oracle Linux 6, 7
|
||||
@@ -89,17 +102,21 @@ OpenJDK is supported on:
|
||||
* Ubuntu 10.04, 12.04, 14.04
|
||||
* Solaris 11
|
||||
* SLES 11 SP1, 12
|
||||
* OpenBSD 5.6, 5.7
|
||||
|
||||
Sun Java is supported on:
|
||||
|
||||
Sun Java is supported on:
|
||||
* Debian 6
|
||||
|
||||
### A note to OpenBSD
|
||||
OpenBSD packages install Java JRE/JDK in a unique directory structure, not linking
|
||||
the binaries to a standard directory. Because of that, the path to this location
|
||||
is hardcoded in the java_version fact. Whenever a Java upgrade to a newer
|
||||
version/path will be done on OpenBSD, it has to be adapted there.
|
||||
|
||||
##Development
|
||||
|
||||
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
|
||||
|
||||
We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
|
||||
|
||||
You can read the complete module contribution guide on the [Puppet Labs wiki](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing).
|
||||
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
|
||||
|
||||
##Contributors
|
||||
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -1,7 +1,7 @@
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.send('relative')
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
||||
|
||||
@@ -11,10 +11,42 @@
|
||||
#
|
||||
# Notes:
|
||||
# None
|
||||
if Facter::Util::Resolution.which('java')
|
||||
Facter.add(:java_version) do
|
||||
setcode do
|
||||
Facter::Util::Resolution.exec('java -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
Facter.add(:java_version) do
|
||||
# the OS-specific overrides need to be able to return nil,
|
||||
# to indicate "no java available". Usually returning nil
|
||||
# would mean that facter falls back to a lower priority
|
||||
# resolution, which would then trigger MODULES-2637. To
|
||||
# avoid that, we confine the "default" here to not run
|
||||
# on those OS.
|
||||
# Additionally, facter versions prior to 2.0.1 only support
|
||||
# positive matches, so this needs to be done manually in setcode.
|
||||
setcode do
|
||||
unless [ 'openbsd', 'darwin' ].include? Facter.value(:operatingsystem).downcase
|
||||
if Facter::Util::Resolution.which('java')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add(:java_version) do
|
||||
confine :operatingsystem => 'OpenBSD'
|
||||
has_weight 100
|
||||
setcode do
|
||||
Facter::Util::Resolution.with_env("PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin') do
|
||||
if Facter::Util::Resolution.which('java')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add(:java_version) do
|
||||
confine :operatingsystem => 'Darwin'
|
||||
has_weight 100
|
||||
setcode do
|
||||
unless /Unable to find any JVMs matching version/ =~ Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1')
|
||||
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ class java::config ( ) {
|
||||
if $java::use_java_package_name != $java::default_package_name {
|
||||
exec { 'create-java-alternatives':
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
command => "alternatives --install ${java::use_java_alternative} java ${$java::use_java_alternative_path} 20000" ,
|
||||
command => "alternatives --install /usr/bin/java java ${$java::use_java_alternative_path} 20000" ,
|
||||
unless => "alternatives --display java | grep -q ${$java::use_java_alternative_path}",
|
||||
before => Exec['update-java-alternatives']
|
||||
}
|
||||
|
||||
@@ -87,6 +87,14 @@ class java(
|
||||
default => '--jre'
|
||||
}
|
||||
|
||||
if $::osfamily == 'Debian' {
|
||||
# Needed for update-java-alternatives
|
||||
package { 'java-common':
|
||||
ensure => present,
|
||||
before => Class['java::config'],
|
||||
}
|
||||
}
|
||||
|
||||
anchor { 'java::begin:': }
|
||||
->
|
||||
package { 'java':
|
||||
|
||||
@@ -15,7 +15,7 @@ class java::params {
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
case $::operatingsystem {
|
||||
'RedHat', 'CentOS', 'OracleLinux', 'Scientific': {
|
||||
'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL': {
|
||||
if (versioncmp($::operatingsystemrelease, '5.0') < 0) {
|
||||
$jdk_package = 'java-1.6.0-sun-devel'
|
||||
$jre_package = 'java-1.6.0-sun'
|
||||
@@ -30,8 +30,14 @@ class java::params {
|
||||
}
|
||||
}
|
||||
'Fedora': {
|
||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||
$jre_package = 'java-1.7.0-openjdk'
|
||||
if (versioncmp($::operatingsystemrelease, '21') < 0) {
|
||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||
$jre_package = 'java-1.7.0-openjdk'
|
||||
}
|
||||
else {
|
||||
$jdk_package = 'java-1.8.0-openjdk-devel'
|
||||
$jre_package = 'java-1.8.0-openjdk'
|
||||
}
|
||||
}
|
||||
'Amazon': {
|
||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||
@@ -46,7 +52,6 @@ class java::params {
|
||||
}
|
||||
'Debian': {
|
||||
case $::lsbdistcodename {
|
||||
default: { fail("unsupported release ${::lsbdistcodename}") }
|
||||
'lenny', 'squeeze', 'lucid', 'natty': {
|
||||
$java = {
|
||||
'jdk' => {
|
||||
@@ -103,6 +108,29 @@ class java::params {
|
||||
},
|
||||
}
|
||||
}
|
||||
'vivid': {
|
||||
$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}/",
|
||||
},
|
||||
'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}/",
|
||||
}
|
||||
}
|
||||
}
|
||||
default: { fail("unsupported release ${::lsbdistcodename}") }
|
||||
}
|
||||
}
|
||||
'OpenBSD': {
|
||||
$java = {
|
||||
'jdk' => { 'package' => 'jdk', },
|
||||
'jre' => { 'package' => 'jre', },
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
@@ -113,11 +141,6 @@ class java::params {
|
||||
}
|
||||
'Suse': {
|
||||
case $::operatingsystem {
|
||||
default: {
|
||||
$jdk_package = 'java-1_6_0-ibm-devel'
|
||||
$jre_package = 'java-1_6_0-ibm'
|
||||
}
|
||||
|
||||
'SLES': {
|
||||
case $::operatingsystemmajrelease{
|
||||
default: {
|
||||
@@ -130,11 +153,14 @@ class java::params {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'OpenSuSE': {
|
||||
$jdk_package = 'java-1_7_0-openjdk-devel'
|
||||
$jre_package = 'java-1_7_0-openjdk'
|
||||
}
|
||||
default: {
|
||||
$jdk_package = 'java-1_6_0-ibm-devel'
|
||||
$jre_package = 'java-1_6_0-ibm'
|
||||
}
|
||||
}
|
||||
$java = {
|
||||
'jdk' => { 'package' => $jdk_package, },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppetlabs-java",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.3",
|
||||
"author": "puppetlabs",
|
||||
"summary": "Installs the correct Java package on various platforms.",
|
||||
"license": "Apache-2.0",
|
||||
@@ -38,6 +38,14 @@
|
||||
"6"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Fedora",
|
||||
"operatingsystemrelease": [
|
||||
"20",
|
||||
"21",
|
||||
"22"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Debian",
|
||||
"operatingsystemrelease": [
|
||||
@@ -70,14 +78,14 @@
|
||||
"requirements": [
|
||||
{
|
||||
"name": "pe",
|
||||
"version_requirement": "3.x"
|
||||
"version_requirement": ">= 3.0.0 < 2015.4.0"
|
||||
},
|
||||
{
|
||||
"name": "puppet",
|
||||
"version_requirement": "3.x"
|
||||
"version_requirement": ">= 3.0.0 < 5.0.0"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"}
|
||||
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0 < 5.0.0"}
|
||||
]
|
||||
}
|
||||
|
||||
11
spec/acceptance/nodesets/ubuntu-server-1504-x64.yml
Normal file
11
spec/acceptance/nodesets/ubuntu-server-1504-x64.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1504-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-15.04-amd64
|
||||
box : puppetlabs/ubuntu-15.04-64-nocm
|
||||
box_url : https://vagrantcloud.com/puppetlabs/ubuntu-15.04-64-nocm
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level : debug
|
||||
type: git
|
||||
@@ -26,17 +26,28 @@ describe 'java', :type => :class do
|
||||
it { should contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Fedora' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora'} }
|
||||
context 'select openjdk for Fedora 20' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora'} }
|
||||
context 'select openjdk for Fedora 21' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
|
||||
it { should contain_package('java').with_name('java-1.8.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 20' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 21' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('java-1.8.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select passed value for Centos 5.3' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
|
||||
let(:params) { { 'package' => 'jdk' } }
|
||||
@@ -97,6 +108,18 @@ describe 'java', :type => :class do
|
||||
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') }
|
||||
end
|
||||
|
||||
context 'select jdk for Ubuntu Vivid (15.04)' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
|
||||
let(:params) { { 'distribution' => 'jdk' } }
|
||||
it { should contain_package('java').with_name('openjdk-8-jdk') }
|
||||
end
|
||||
|
||||
context 'select jre for Ubuntu Vivid (15.04)' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('openjdk-8-jre-headless') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Amazon Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64'} }
|
||||
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
@@ -135,6 +158,17 @@ describe 'java', :type => :class do
|
||||
it { should contain_package('java').with_name('java-1_7_0-openjdk-devel')}
|
||||
end
|
||||
|
||||
context 'select jdk for OpenBSD' do
|
||||
let(:facts) { {:osfamily => 'OpenBSD'} }
|
||||
it { should contain_package('java').with_name('jdk') }
|
||||
end
|
||||
|
||||
context 'select jre for OpenBSD' do
|
||||
let(:facts) { {:osfamily => 'OpenBSD'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { should contain_package('java').with_name('jre') }
|
||||
end
|
||||
|
||||
describe 'incompatible OSs' do
|
||||
[
|
||||
{
|
||||
@@ -170,7 +204,7 @@ describe 'java', :type => :class do
|
||||
].each do |facts|
|
||||
let(:facts) { facts }
|
||||
it "should fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do
|
||||
expect { subject }.to raise_error Puppet::Error, /unsupported platform/
|
||||
expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
|
||||
RSpec.configure do |c|
|
||||
# declare an exclusion filter for the tests using with_env on facter 1.6, as the function is not available on 1.6
|
||||
c.filter_run_excluding :with_env => true if Facter.version =~ /^1\.6\./
|
||||
end
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
require 'beaker-rspec'
|
||||
require 'beaker/puppet_install_helper'
|
||||
|
||||
run_puppet_install_helper
|
||||
|
||||
UNSUPPORTED_PLATFORMS = [ "Darwin", "windows" ]
|
||||
|
||||
unless ENV["RS_PROVISION"] == "no" or ENV["BEAKER_provision"] == "no"
|
||||
# This will install the latest available package on el and deb based
|
||||
# systems fail on windows and osx, and install via gem on other *nixes
|
||||
foss_opts = { :default_action => 'gem_install' }
|
||||
|
||||
if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
|
||||
|
||||
hosts.each do |host|
|
||||
if host["platform"] =~ /solaris/
|
||||
on host, "echo 'export PATH=/opt/puppet/bin:/var/ruby/1.8/gem_home/bin:${PATH}' >> ~/.bashrc"
|
||||
end
|
||||
unless host.is_pe?
|
||||
on host, "/bin/mkdir -p #{host["puppetpath"]}"
|
||||
on host, "/bin/echo '' > #{host["hieraconf"]}"
|
||||
end
|
||||
on host, "mkdir -p #{host["distmoduledir"]}"
|
||||
if host['platform'] =~ /sles-1/i || host['platform'] =~ /solaris-1/i
|
||||
get_stdlib = <<-stdlib
|
||||
package{'wget':}
|
||||
|
||||
@@ -11,7 +11,7 @@ describe Facter::Util::Fact do
|
||||
Facter.fact(:java_version).stubs(:value).returns('1.7.0_71')
|
||||
end
|
||||
it do
|
||||
Facter.fact(:java_major_version).value.should == "7"
|
||||
expect(Facter.fact(:java_major_version).value).to eq("7")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,8 +20,8 @@ describe Facter::Util::Fact do
|
||||
Facter.fact(:java_version).stubs(:value).returns(nil)
|
||||
end
|
||||
it do
|
||||
Facter.fact(:java_major_version).value.should be_nil
|
||||
expect(Facter.fact(:java_major_version).value).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,20 +12,20 @@ describe Facter::Util::Fact do
|
||||
Facter.fact(:java_version).stubs(:value).returns('1.7.0_71')
|
||||
end
|
||||
it do
|
||||
Facter.fact(:java_patch_level).value.should == "71"
|
||||
expect(Facter.fact(:java_patch_level).value).to eq("71")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "if java is installed" do
|
||||
context 'returns java patch version extracted from java_version fact' do
|
||||
context "if java is not installed" do
|
||||
context 'returns nil' do
|
||||
before :each do
|
||||
Facter.fact(:java_version).stubs(:value).returns(nil)
|
||||
end
|
||||
it do
|
||||
Facter.fact(:java_patch_level).value.should be_nil
|
||||
expect(Facter.fact(:java_patch_level).value).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,24 +7,86 @@ describe Facter::Util::Fact do
|
||||
|
||||
describe "java_version" do
|
||||
context 'returns java version when java present' do
|
||||
it do
|
||||
java_version_output = <<-EOS
|
||||
context 'on OpenBSD', :with_env => true do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("OpenBSD")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'OpenBSD'} }
|
||||
it do
|
||||
java_version_output = <<-EOS
|
||||
openjdk version "1.7.0_71"
|
||||
OpenJDK Runtime Environment (build 1.7.0_71-b14)
|
||||
OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:which).with("java").returns('/usr/local/jdk-1.7.0/jre/bin/java')
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
expect(Facter.value(:java_version)).to eq("1.7.0_71")
|
||||
end
|
||||
end
|
||||
context 'on Darwin' do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("Darwin")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'Darwin'} }
|
||||
it do
|
||||
java_version_output = <<-EOS
|
||||
java version "1.7.0_71"
|
||||
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:which).with("java").returns(true)
|
||||
Facter::Util::Resolution.expects(:exec).with("java -version 2>&1").returns(java_version_output)
|
||||
Facter.fact(:java_version).value.should == "1.7.0_71"
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:exec).with("/usr/libexec/java_home --failfast 2>&1").returns("/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home")
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
Facter.value(:java_version).should == "1.7.0_71"
|
||||
end
|
||||
end
|
||||
context 'on other systems' do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("MyOS")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'MyOS'} }
|
||||
it do
|
||||
java_version_output = <<-EOS
|
||||
java version "1.7.0_71"
|
||||
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
|
||||
EOS
|
||||
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
|
||||
expect(Facter.value(:java_version)).to eq("1.7.0_71")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'returns nil when java not present' do
|
||||
it do
|
||||
Facter::Util::Resolution.stubs(:exec)
|
||||
Facter::Util::Resolution.expects(:which).with("java").returns(false)
|
||||
Facter.fact(:java_version).should be_nil
|
||||
context 'on OpenBSD', :with_env => true do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("OpenBSD")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'OpenBSD'} }
|
||||
it do
|
||||
Facter::Util::Resolution.stubs(:exec)
|
||||
expect(Facter.value(:java_version)).to be_nil
|
||||
end
|
||||
end
|
||||
context 'on Darwin' do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("Darwin")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'Darwin'} }
|
||||
it do
|
||||
Facter::Util::Resolution.expects(:exec).at_least(1).with("/usr/libexec/java_home --failfast 2>&1").returns('Unable to find any JVMs matching version "(null)".')
|
||||
Facter.value(:java_version).should be_nil
|
||||
end
|
||||
end
|
||||
context 'on other systems' do
|
||||
before do
|
||||
Facter.fact(:operatingsystem).stubs(:value).returns("MyOS")
|
||||
end
|
||||
let(:facts) { {:operatingsystem => 'MyOS'} }
|
||||
it do
|
||||
Facter::Util::Resolution.expects(:which).at_least(1).with("java").returns(false)
|
||||
expect(Facter.value(:java_version)).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user