Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Adding a wrap_java parameter to allow disabling use of the java.sh script #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ You can customise this module by configuring some optional class parameters. Usu

* `update_version`: The 'update' part of the JRE/JDK version to install. For example, if you specify `51`, the module would install java 7u51
* `base_download_url`: A base path from which the JRE and JDK packages should be downloaded. For example, if you specify `https://myorg.example/dist/java`, this module would download the jre from `https://myorg.example/dist/java/jre-7u51-macosx-x64.dmg`.
* `wrap_java`: Whether to add a `java` script in boxen::config::bindir that modifies DYLD_FALLBACK_LIBRARY_PATH and JAVA_HOME

All of these parameters have sensible defaults, and are provided if you need more control.

Expand Down
13 changes: 8 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# include java
class java (
$update_version = '55',
$base_download_url = 'https://s3.amazonaws.com/boxen-downloads/java'
$base_download_url = 'https://s3.amazonaws.com/boxen-downloads/java',
$wrap_java = true,
) {
include boxen::config

Expand All @@ -28,10 +29,12 @@
source => $jdk_url ;
}

file { $wrapper:
source => 'puppet:///modules/java/java.sh',
mode => '0755',
require => Package['java']
if $wrap_java {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a conditional, it's probably better to use the ensure parameter of the file resource. That way, if wrap_java = false, then the wrapper will get removed if it were there before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loyal3-green-team If you can do this then we'll merge it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and rebase it)

file { $wrapper:
source => 'puppet:///modules/java/java.sh',
mode => '0755',
require => Package['java']
}
}


Expand Down
21 changes: 21 additions & 0 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@
:require => 'Package[java]'
})
end


end

describe "java" do
let(:facts) { default_test_facts }
let(:params) {
{
:wrap_java => false
}
}

it do
should_not contain_file('/test/boxen/bin/java').with({
:source => 'puppet:///modules/java/java.sh',
:mode => '0755',
:require => 'Package[java]'
})
end
end