Compare commits

...

34 Commits
2.1.0 ... 2.1.1

Author SHA1 Message Date
Eric Putnam
336a0e2e1a Merge pull request #263 from pmcmaw/paulaTesting
(FM-6503) - Release Prep for 2.2.1
2017-11-08 09:25:50 -08:00
Paula McMaw
6592edd454 (FM-6503) - Release Prep for 2.2.1 2017-11-06 15:35:10 +00:00
Helen
e6e961e7fc Merge pull request #261 from bastelfreak/bumparchivebmjenplsmerge
allow latest archive version as dependency
2017-10-09 17:51:01 +01:00
Tim Meusel
2b2e639531 allow latest archive version as dependency 2017-10-09 18:30:09 +02:00
TP Honey
5f820fe8bd Merge pull request #257 from shuebnersr/fact1754_java_version_fails_when_JAVA_TOOL_OPTIONS_is_used
(FACT-1754) search for matching line with java version
2017-10-02 12:41:05 +01:00
shuebnersr
b7bdf96252 Fixed search for matching line with java version
Use value of variable instead of return statement
Extended unit test for checking handling of JAVA_TOOL_OPTIONS
2017-10-01 15:15:01 +02:00
TP Honey
231db77fe7 Merge pull request #203 from vrtdev/bugfix/override_package_alt_home
#MODULES-4069: Fail when required params are not available in params.
2017-09-26 14:02:45 +01:00
TP Honey
cb7105f4a2 Merge pull request #258 from shuebnersr/fact1760_test_for_java_version_when_java_not_installed
Fact1760 test for java version when java not installed
2017-09-26 14:00:12 +01:00
Jan Vansteenkiste
c40b061d97 (MODULES-4069) Fail when required params are not available in params.
When overriding all values required for the java setup, there is
no need to fail if params.pp does not support the package.
2017-09-26 07:37:41 +02:00
shuebnersr
18bd3fcb86 Merge pull request #2 from shuebnersr/fact1760_test_for_java_version_when_java_not_installed
Fact1760 test for java version when java not installed
2017-09-22 12:00:35 +02:00
shuebnersr
578eb951ea fix java_version test for other systems
mock Facter::Util::Resolution.which('java') for the "other systems" test; before it was not mocked and was based on Java being installed on the test system or not
2017-09-22 11:50:41 +02:00
shuebnersr
318f8864fd Merge pull request #1 from puppetlabs/master
sync
2017-09-22 11:39:28 +02:00
TP Honey
62f054649a Merge pull request #256 from puppetlabs/msync_18sep17_892c4cf
(maint) modulesync 892c4cf
2017-09-21 13:52:59 +01:00
shuebnersr
d89532435d search for matching line with java version
do not just try to read java version from first line, but search for the matching line from java output
2017-09-20 14:26:04 +02:00
Hailee Kenney
6397c0870b (maint) modulesync 892c4cf 2017-09-18 14:56:13 -07:00
Paula McMaw
e4888a507e Merge pull request #255 from Andor/master
Support for Ubuntu 17.04 Zesty Zapus
2017-09-08 11:41:23 +01:00
Andrew N Golovkov
525016ec02 Support for Ubuntu 17.04 Zesty Zapus 2017-09-06 20:44:48 +03:00
Helen
c5005d9cc1 Merge pull request #254 from pmcmaw/rm_debian6
Removing Debian 6
2017-08-31 11:30:33 +01:00
Paula McMaw
7f8bb518f0 Removing Debian 6
According to the followin page Debian 6 is no longer supported as an
Agent. https://docs.puppet.com/pe/latest/sys_req_os.html
2017-08-31 11:20:41 +01:00
TP Honey
771a3a6702 Merge pull request #253 from pmcmaw/rm_ubuntu
(MODULES-5501) - Remove unsupported Ubuntu
2017-08-17 16:00:54 +01:00
Paula McMaw
c74f533e0b (MODULES-5501) - Remove unsupported Ubuntu
Removing older version of Ubuntu that are not supported by the module.
2017-08-17 14:08:56 +01:00
Shaleen Gupta
43aa9af1b2 Add support for CloudLinux (#251)
Fix the fail "unsupported os CloudlLinux".
2017-08-01 13:30:38 +01:00
Paula McMaw
cceb78b7fe Merge pull request #252 from puppetlabs/maint-modsync-915cde70e20
(maint) modulesync 915cde70e20
2017-07-28 11:34:12 +01:00
Glenn Sarti
b50e762f1c (maint) modulesync 915cde70e20 2017-07-27 15:00:09 -07:00
Hunter Haugen
e9c50332bd Merge pull request #249 from puppetlabs/msync_modules5187
(MODULES-5187) msync puppet 5 and ruby 2.4
2017-07-10 14:51:42 -07:00
Eric Putnam
795b92a81d (MODULES-5187) mysnc puppet 5 and ruby 2.4 2017-07-06 14:41:47 -07:00
Glenn Sarti
31799ce4e7 Merge pull request #247 from hunner/bump_metadata
(MODULES-5144) Prep for puppet 5
2017-06-26 22:31:31 -07:00
Hunter Haugen
2829b75e83 (MODULES-5144) Prep for puppet 5 2017-06-26 14:12:02 -07:00
Bryan Jen
0ea0b663fa Merge pull request #246 from puppetlabs/release
2.1.0 mergeback
2017-06-22 16:30:00 -07:00
Hunter Haugen
6bbaacdb39 Merge pull request #244 from kBite/add-support-for-arch-linux
Add support for Archlinux
2017-06-21 14:29:25 -07:00
Kilian Engelhardt
6951263d4c fix indentation and remove a white line 2017-06-21 11:26:24 +02:00
Kilian Engelhardt
0bcdd2bc2f add basic arch linux support 2017-06-21 10:59:39 +02:00
Paula McMaw
8763d0b388 Merge pull request #239 from puppetlabs/revert-238-release
Revert "Release Mergeback 2.1.0"
2017-06-15 11:20:16 +01:00
Helen
184c745e82 Revert "Release Mergeback 2.1.0" 2017-06-15 11:03:44 +01:00
13 changed files with 283 additions and 134 deletions

View File

@@ -22,10 +22,10 @@ matrix:
script: bundle exec rake beaker script: bundle exec rake beaker
services: docker services: docker
sudo: required sudo: required
- rvm: 2.3.1 - rvm: 2.4.0
bundler_args: --without system_tests bundler_args: --without system_tests
env: PUPPET_GEM_VERSION="~> 4.0" env: PUPPET_GEM_VERSION="~> 5.0"
- rvm: 2.1.7 - rvm: 2.1.9
bundler_args: --without system_tests bundler_args: --without system_tests
env: PUPPET_GEM_VERSION="~> 4.0" env: PUPPET_GEM_VERSION="~> 4.0"
notifications: notifications:

View File

@@ -1,14 +1,29 @@
## Supported Release 2.1.1
### Summary
This release is a maintenance release that includes a roll up of minor changes.
#### Added
- Basic Arch Linux, Cloud Linux and Ubuntu 17.04 compatibility.
- Metadata bump for Puppet 5.
- Search for matching line with java version.
- ([MODULES-4069](https://tickets.puppet.com/browse/MODULES-4069)) Fail when required params are not available in params.
- A test for java version when java not installed.
- Allow latest archive version as dependency.
#### Changed
- CONTRIBUTING.md document includes updates.
- Removal of Ubuntu 10.04 ad 12.04, Debian 6 in supported versions.
## Supported Release 2.1.0 ## Supported Release 2.1.0
### Summary ### Summary
This release adds fixes to restore the ability to install Oracle Java. It also This release adds fixes to restore the ability to install Oracle Java. It also fixes the paths for the latest RHEL 7 1.7.0 and 1.8.0 OpenJDKs.
fixes the paths for the latest RHEL 7 1.7.0 and 1.8.0 OpenJDKs.
### Added ### Added
- java::oracle parameter `url` - java::oracle parameter `url`
- java::oracle parameter `url_hash` - java::oracle parameter `url_hash`
### Fixed ### Fixed
- Let `java_default_home` fact work when /usr/bin/java doesn't exist - Let `java_default_home` fact work when /usr/bin/java does not exist
- Add puppet 4 parameter types - Add puppet 4 parameter types
- Use `/usr/lib/jvm/java-1.x.0` symlinks for `java_home` defaults. - Use `/usr/lib/jvm/java-1.x.0` symlinks for `java_home` defaults.

View File

@@ -1,63 +1,75 @@
Checklist (and a short version for the impatient) # Contributing to Puppet modules
=================================================
* Commits: So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing
that very thing while setting expectations around code quality as well as a few tips for making the
process as easy as possible.
- Make commits of logical units. ### Table of Contents
- Check for unnecessary whitespace with "git diff --check" before 1. [Getting Started](#getting-started)
committing. 1. [Commit Checklist](#commit-checklist)
1. [Submission](#submission)
1. [More about commits](#more-about-commits)
1. [Testing](#testing)
- [Running Tests](#running-tests)
- [Writing Tests](#writing-tests)
1. [Get Help](#get-help)
- Commit using Unix line endings (check the settings around "crlf" in ## Getting Started
git-config(1)).
- Do not check in commented out code or unneeded files. - Fork the module repository on GitHub and clone to your workspace
- The first line of the commit message should be a short - Make your changes!
description (50 characters is the soft limit, excluding ticket
number(s)), and should skip the full stop.
- Associate the issue in the message. The first line should include ## Commit Checklist
the issue number in the form "(#XXXX) Rest of message".
- The body should provide a meaningful commit message, which: ### The Basics
- uses the imperative, present tense: "change", not "changed" or - [x] my commit is a single logical unit of work
"changes".
- includes motivation for the change, and contrasts its - [x] I have checked for unnecessary whitespace with "git diff --check"
implementation with the previous behavior.
- Make sure that you have tests for the bug you are fixing, or - [x] my commit does not include commented out code or unneeded files
feature you are adding.
- Make sure the test suites passes after your commit: ### The Content
`bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
- When introducing a new feature, make sure it is properly - [x] my commit includes tests for the bug I fixed or feature I added
documented in the README.md
* Submission: - [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
* Pre-requisites: - [x] my code passes existing test suites
- Make sure you have a [GitHub account](https://github.com/join) ### The Commit Message
- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for. - [x] the first line of my commit message includes:
* Preferred method: - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line"
- Fork the repository on GitHub. - [x] a short description (50 characters is the soft limit, excluding ticket number(s))
- Push your changes to a topic branch in your fork of the - [x] the body of my commit message:
repository. (the format ticket/1234-short_description_of_change is
usually preferred for this project).
- Submit a pull request to the repository in the puppetlabs - [x] is meaningful
organization.
The long version - [x] uses the imperative, present tense: "change", not "changed" or "changes"
================
- [x] includes motivation for the change, and contrasts its implementation with the previous behavior
## Submission
### Pre-requisites
- Make sure you have a [GitHub account](https://github.com/join)
- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
### Push and PR
- Push your changes to your fork
- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
## More about commits
1. Make separate commits for logically separate changes. 1. Make separate commits for logically separate changes.
@@ -104,37 +116,32 @@ The long version
GitHub has some pretty good GitHub has some pretty good
[general documentation](http://help.github.com/) on using [general documentation](http://help.github.com/) on using
their site. They also have documentation on their site. They also have documentation on
[creating pull requests](http://help.github.com/send-pull-requests/). [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
In general, after pushing your topic branch up to your In general, after pushing your topic branch up to your
repository on GitHub, you can switch to the branch in the repository on GitHub, you can switch to the branch in the
GitHub UI and click "Pull Request" towards the top of the page GitHub UI and click "Pull Request" towards the top of the page
in order to open a pull request. in order to open a pull request.
3. Update the related JIRA issue.
3. Update the related GitHub issue. If there is a JIRA issue associated with the change you
If there is a GitHub issue associated with the change you
submitted, then you should update the ticket to include the submitted, then you should update the ticket to include the
location of your branch, along with any other commentary you location of your branch, along with any other commentary you
may wish to make. may wish to make.
Testing # Testing
=======
Getting Started ## Getting Started
---------------
Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
package manager such as [bundler](http://bundler.io/) what Ruby packages,
or Gems, are required to build, develop, and test this software. or Gems, are required to build, develop, and test this software.
Please make sure you have [bundler installed](http://bundler.io/#getting-started) Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to
on your system, then use it to install all dependencies needed for this project, install all dependencies needed for this project in the project root by running
by running
```shell ```shell
% bundle install % bundle install --path .bundle/gems
Fetching gem metadata from https://rubygems.org/........ Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.. Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0) Using rake (10.1.0)
@@ -148,7 +155,7 @@ Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed. Use `bundle show [gemname]` to see where a bundled gem is installed.
``` ```
NOTE some systems may require you to run this command with sudo. NOTE: some systems may require you to run this command with sudo.
If you already have those gems installed, make sure they are up-to-date: If you already have those gems installed, make sure they are up-to-date:
@@ -156,26 +163,27 @@ If you already have those gems installed, make sure they are up-to-date:
% bundle update % bundle update
``` ```
With all dependencies in place and up-to-date we can now run the tests: ## Running Tests
With all dependencies in place and up-to-date, run the tests:
### Unit Tests
```shell ```shell
% bundle exec rake spec % bundle exec rake spec
``` ```
This will execute all the [rspec tests](http://rspec-puppet.com/) tests This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on.
under [spec/defines](./spec/defines), [spec/classes](./spec/classes), rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json),
and so on. rspec tests may have the same kind of dependencies as the
module they are testing. While the module defines in its [Modulefile](./Modulefile),
rspec tests define them in [.fixtures.yml](./fixtures.yml). rspec tests define them in [.fixtures.yml](./fixtures.yml).
Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker) ### Acceptance Tests
tests. These tests spin up a virtual machine under
[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
scenarios. In order to run these, you will need both of those tools
installed on your system.
You can run them by issuing the following command Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under
[VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test
scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system.
Run the tests by issuing the following command
```shell ```shell
% bundle exec rake spec_clean % bundle exec rake spec_clean
@@ -183,35 +191,81 @@ You can run them by issuing the following command
``` ```
This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
and then run all the tests under [spec/acceptance](./spec/acceptance). and then run all the tests under [spec/acceptance](./spec/acceptance).
Writing Tests ## Writing Tests
-------------
XXX getting started writing tests. ### Unit Tests
If you have commit access to the repository When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a
=========================================== catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs]
but here's a tiny sample:
Even if you have commit access to the repository, you will still need to Sample manifest:
go through the process above, and have someone else review and merge
in your changes. The rule is that all changes must be reviewed by a
developer on the project (that did not write the code) to ensure that
all changes go through a code review process.
Having someone other than the author of the topic branch recorded as ```puppet
performing the merge is the record that they performed the code file { "a test file":
review. ensure => present,
path => "/etc/sample",
}
```
Sample test:
Additional Resources ```ruby
==================== it 'does a thing' do
expect(subject).to contain_file("a test file").with({:path => "/etc/sample"})
end
```
* [Getting additional help](http://puppet.com/community/get-help) ### Acceptance Tests
Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it
twice to check for idempotency or errors, then run expectations.
```ruby
it 'does an end-to-end thing' do
pp = <<-EOF
file { 'a test file':
ensure => present,
path => "/etc/sample",
content => "test string",
}
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe file("/etc/sample") do
it { is_expected.to contain "test string" }
end
```
# If you have commit access to the repository
Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that
all changes go through a code review process.**
The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch.
# Get Help
### On the web
* [Puppet help messageboard](http://puppet.com/community/get-help)
* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing) * [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
* [General GitHub documentation](http://help.github.com/) * [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
### On chat
* Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
* IRC (freenode) #puppet-dev, #voxpupuli
[rspec-puppet]: http://rspec-puppet.com/
[rspec-puppet_docs]: http://rspec-puppet.com/documentation/
[beaker]: https://github.com/puppetlabs/beaker
[beaker-rspec]: https://github.com/puppetlabs/beaker-rspec

View File

@@ -36,7 +36,7 @@ group :development do
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby" gem "puppet-module-posix-default-r#{minor_version}", :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}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "puppet-module-posix-dev-r#{minor_version}", :require => false, :platforms => "ruby" gem "puppet-module-posix-dev-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-dev-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"] gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
@@ -50,6 +50,7 @@ group :system_tests do
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION']) gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION']) gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "puppet-blacksmith", '~> 3.4', :require => false
end end
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])

View File

@@ -22,9 +22,11 @@ Facter.add(:java_version) do
# positive matches, so this needs to be done manually in setcode. # positive matches, so this needs to be done manually in setcode.
setcode do setcode do
unless [ 'openbsd', 'darwin' ].include? Facter.value(:operatingsystem).downcase unless [ 'openbsd', 'darwin' ].include? Facter.value(:operatingsystem).downcase
version = nil
if Facter::Util::Resolution.which('java') if Facter::Util::Resolution.which('java')
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = $~[1] if /^.+ version \"(.+)\"$/ =~ line }
end end
version
end end
end end
end end
@@ -34,9 +36,11 @@ Facter.add(:java_version) do
has_weight 100 has_weight 100
setcode do setcode do
Facter::Util::Resolution.with_env("PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin') do Facter::Util::Resolution.with_env("PATH" => '/usr/local/jdk-1.7.0/jre/bin:/usr/local/jre-1.7.0/bin') do
version = nil
if Facter::Util::Resolution.which('java') if Facter::Util::Resolution.which('java')
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = $~[1] if /^.+ version \"(.+)\"$/ =~ line }
end end
version
end end
end end
end end
@@ -46,7 +50,9 @@ Facter.add(:java_version) do
has_weight 100 has_weight 100
setcode do setcode do
unless /Unable to find any JVMs matching version/ =~ Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1') unless /Unable to find any JVMs matching version/ =~ Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1')
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.first.split(/"/)[1].strip version = nil
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = $~[1] if /^.+ version \"(.+)\"$/ =~ line }
version
end end
end end
end end

View File

@@ -22,4 +22,5 @@ gettext:
# Patterns for +Dir.glob+ used to find all files that might contain # Patterns for +Dir.glob+ used to find all files that might contain
# translatable content, relative to the project root directory # translatable content, relative to the project root directory
source_files: source_files:
- './lib/**/*.rb'

View File

@@ -62,6 +62,15 @@ class java::config ( ) {
} }
} }
} }
'Archlinux': {
if $java::use_java_home != undef {
file_line { 'java-home-environment':
path => '/etc/profile',
line => "JAVA_HOME=${$java::use_java_home}",
match => 'JAVA_HOME=',
}
}
}
default: { default: {
# Do nothing. # Do nothing.
} }

View File

@@ -9,7 +9,6 @@
# or other platform-specific options where there are multiple # or other platform-specific options where there are multiple
# implementations available (eg: OpenJDK vs Oracle JDK). # implementations available (eg: OpenJDK vs Oracle JDK).
# #
#
# [*version*] # [*version*]
# The version of java to install. By default, this module simply ensures # The version of java to install. By default, this module simply ensures
# that java is present, and does not require a specific version. # that java is present, and does not require a specific version.
@@ -54,15 +53,11 @@ class java(
Optional[String] $java_alternative_path = undef, Optional[String] $java_alternative_path = undef,
Optional[String] $java_home = undef Optional[String] $java_home = undef
) { ) {
include java::params include ::java::params
if has_key($java::params::java, $distribution) { $default_package_name = has_key($java::params::java, $distribution) ? {
$default_package_name = $java::params::java[$distribution]['package'] false => undef,
$default_alternative = $java::params::java[$distribution]['alternative'] default => $java::params::java[$distribution]['package'],
$default_alternative_path = $java::params::java[$distribution]['alternative_path']
$default_java_home = $java::params::java[$distribution]['java_home']
} else {
fail("Java distribution ${distribution} is not supported.")
} }
$use_java_package_name = $package ? { $use_java_package_name = $package ? {
@@ -70,12 +65,17 @@ class java(
default => $package, default => $package,
} }
## Weird logic........
## If $java_alternative is set, use that. ## If $java_alternative is set, use that.
## Elsif the DEFAULT package is being used, then use $default_alternative. ## Elsif the DEFAULT package is being used, then use $default_alternative.
## Else undef ## Else undef
$use_java_alternative = $java_alternative ? { $use_java_alternative = $java_alternative ? {
undef => $use_java_package_name ? { undef => $use_java_package_name ? {
$default_package_name => $default_alternative, $default_package_name => has_key($java::params::java, $distribution) ? {
default => $java::params::java[$distribution]['alternative'],
false => undef,
},
default => undef, default => undef,
}, },
default => $java_alternative, default => $java_alternative,
@@ -84,7 +84,10 @@ class java(
## Same logic as $java_alternative above. ## Same logic as $java_alternative above.
$use_java_alternative_path = $java_alternative_path ? { $use_java_alternative_path = $java_alternative_path ? {
undef => $use_java_package_name ? { undef => $use_java_package_name ? {
$default_package_name => $default_alternative_path, $default_package_name => has_key($java::params::java, $distribution) ? {
default => $java::params::java[$distribution]['alternative_path'],
false => undef,
},
default => undef, default => undef,
}, },
default => $java_alternative_path, default => $java_alternative_path,
@@ -92,12 +95,26 @@ class java(
$use_java_home = $java_home ? { $use_java_home = $java_home ? {
undef => $use_java_package_name ? { undef => $use_java_package_name ? {
$default_package_name => $default_java_home, $default_package_name => has_key($java::params::java, $distribution) ? {
default => $java::params::java[$distribution]['java_home'],
false => undef,
},
default => undef, default => undef,
}, },
default => $java_home, default => $java_home,
} }
## This should only be required if we did not override all the information we need.
# One of the defaults is missing and its not intentional:
if ((
$use_java_package_name == undef or $use_java_alternative == undef or
$use_java_alternative_path == undef or $use_java_home == undef
) and (
! has_key($::java::params::java, $distribution)
)) {
fail("Java distribution ${distribution} is not supported. Missing default values.")
}
$jre_flag = $use_java_package_name ? { $jre_flag = $use_java_package_name ? {
/headless/ => '--jre-headless', /headless/ => '--jre-headless',
default => '--jre' default => '--jre'

View File

@@ -213,9 +213,11 @@ define java::oracle (
# if complete URL is provided, use this value for source in archive resource # if complete URL is provided, use this value for source in archive resource
if $url { if $url {
$source = $url $source = $url
} elsif $release_hash != undef { }
elsif $release_hash != undef {
$source = "${oracle_url}/${release_major}-${release_minor}/${release_hash}/${package_name}" $source = "${oracle_url}/${release_major}-${release_minor}/${release_hash}/${package_name}"
} else { }
else {
$source = "${oracle_url}/${release_major}-${release_minor}/${package_name}" $source = "${oracle_url}/${release_major}-${release_minor}/${package_name}"
} }
@@ -256,7 +258,7 @@ define java::oracle (
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin', path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
command => $install_command, command => $install_command,
creates => $creates_path, creates => $creates_path,
require => Archive[$destination], require => Archive[$destination]
} }
} }
default : { default : {

View File

@@ -15,7 +15,7 @@ class java::params {
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
case $::operatingsystem { case $::operatingsystem {
'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL', 'SLC': { 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL', 'SLC', 'CloudLinux': {
if (versioncmp($::operatingsystemrelease, '5.0') < 0) { if (versioncmp($::operatingsystemrelease, '5.0') < 0) {
$jdk_package = 'java-1.6.0-sun-devel' $jdk_package = 'java-1.6.0-sun-devel'
$jre_package = 'java-1.6.0-sun' $jre_package = 'java-1.6.0-sun'
@@ -155,7 +155,7 @@ class java::params {
}, },
} }
} }
'stretch', 'vivid', 'wily', 'xenial', 'yakkety': { 'stretch', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty': {
$java = { $java = {
'jdk' => { 'jdk' => {
'package' => 'openjdk-8-jdk', 'package' => 'openjdk-8-jdk',
@@ -253,6 +253,21 @@ class java::params {
}, },
} }
} }
'Archlinux': {
$jdk_package = 'jdk8-openjdk'
$jre_package = 'jre8-openjdk'
$java_home = '/usr/lib/jvm/java-8-openjdk/jre/'
$java = {
'jdk' => {
'package' => $jdk_package,
'java_home' => $java_home,
},
'jre' => {
'package' => $jre_package,
'java_home' => $java_home,
},
}
}
default: { fail("unsupported platform ${::osfamily}") } default: { fail("unsupported platform ${::osfamily}") }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "puppetlabs-java", "name": "puppetlabs-java",
"version": "2.1.0", "version": "2.1.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",
@@ -49,7 +49,6 @@
{ {
"operatingsystem": "Debian", "operatingsystem": "Debian",
"operatingsystemrelease": [ "operatingsystemrelease": [
"6",
"7", "7",
"8" "8"
] ]
@@ -57,8 +56,6 @@
{ {
"operatingsystem": "Ubuntu", "operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "operatingsystemrelease": [
"10.04",
"12.04",
"14.04", "14.04",
"16.04" "16.04"
] ]
@@ -85,7 +82,7 @@
"requirements": [ "requirements": [
{ {
"name": "puppet", "name": "puppet",
"version_requirement": ">= 4.7.0 < 5.0.0" "version_requirement": ">= 4.7.0 < 6.0.0"
} }
], ],
"dependencies": [ "dependencies": [
@@ -95,7 +92,7 @@
}, },
{ {
"name":"puppet/archive", "name":"puppet/archive",
"version_requirement": ">= 1.1.0 < 2.0.0" "version_requirement": ">= 1.1.0 < 3.0.0"
} }
] ]
} }

View File

@@ -245,6 +245,34 @@ describe 'java', :type => :class do
it { is_expected.to contain_package('java').with_name('jre') } it { is_expected.to contain_package('java').with_name('jre') }
end end
describe 'custom java package' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'jessie', :operatingsystemrelease => '8.6', :architecture => 'amd64',} }
context 'all params provided' do
let(:params) { {
'distribution' => 'custom',
'package' => 'custom_jdk',
'java_alternative' => 'java-custom_jdk',
'java_alternative_path' => '/opt/custom_jdk/bin/java',
'java_home' => '/opt/custom_jdk',
} }
it { is_expected.to contain_package('java').with_name('custom_jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/opt/custom_jdk') }
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-custom_jdk --jre') }
end
context 'missing parameters' do
let(:params) { {
'distribution' => 'custom',
'package' => 'custom_jdk',
} }
it do
expect { catalogue }.to raise_error Puppet::Error, /is not supported. Missing default values/
end
end
end
describe 'incompatible OSs' do describe 'incompatible OSs' do
[ [
{ {

View File

@@ -14,6 +14,7 @@ describe Facter::Util::Fact do
let(:facts) { {:operatingsystem => 'OpenBSD'} } let(:facts) { {:operatingsystem => 'OpenBSD'} }
it do it do
java_version_output = <<-EOS java_version_output = <<-EOS
Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
openjdk version "1.7.0_71" openjdk version "1.7.0_71"
OpenJDK Runtime Environment (build 1.7.0_71-b14) OpenJDK Runtime Environment (build 1.7.0_71-b14)
OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode) OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
@@ -30,6 +31,7 @@ OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
let(:facts) { {:operatingsystem => 'Darwin'} } let(:facts) { {:operatingsystem => 'Darwin'} }
it do it do
java_version_output = <<-EOS java_version_output = <<-EOS
Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
java version "1.7.0_71" java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
@@ -46,10 +48,12 @@ Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
let(:facts) { {:operatingsystem => 'MyOS'} } let(:facts) { {:operatingsystem => 'MyOS'} }
it do it do
java_version_output = <<-EOS java_version_output = <<-EOS
Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
java version "1.7.0_71" java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
EOS EOS
Facter::Util::Resolution.expects(:which).with("java").returns('/path/to/java')
Facter::Util::Resolution.expects(:exec).with("java -Xmx12m -version 2>&1").returns(java_version_output) Facter::Util::Resolution.expects(:exec).with("java -Xmx12m -version 2>&1").returns(java_version_output)
expect(Facter.value(:java_version)).to eq("1.7.0_71") expect(Facter.value(:java_version)).to eq("1.7.0_71")
end end