From 4cfed6e790f4a0e1611dcd7a2c3b153de34e41f6 Mon Sep 17 00:00:00 2001 From: deigote Date: Tue, 4 Jun 2013 09:28:31 +0200 Subject: [PATCH 1/3] Added some parametrization options so the class doesn't need to be updated with each java version and also for allowing the original tarball to not be in the module directory --- manifests/init.pp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d04035d..d76b8e4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,18 +1,30 @@ -class java7 { - $version = "1.7.0_05" +class java7 ($version = "1.7.0_05", $tarball_name_prefix = "jdk-7u5-linux", $jdk_path = "") { + $tarball = $architecture ? { - "amd64" => "jdk-7u5-linux-x64.tar.gz", - default => "jdk-7u5-linux-i586.tar.gz", + "amd64" => "${tarball_name_prefix}-x64.tar.gz", + default => "${tarball_name_prefix}-i586.tar.gz", } package { "java-common": ensure => latest, } - file { "java-tarball": - ensure => file, - path => "/tmp/$tarball", - source => "puppet:///modules/java7/${tarball}", + if jdk_path == "" { + file { "java-tarball": + ensure => file, + path => "/tmp/$tarball", + source => "puppet:///modules/java7/${tarball}", + } + } + else { + exec { "cp-java-tarball-to-tmp": + command => "cp $jdk_path/$tarball /tmp/$tarball", + unless => "[ -f /tmp/$tarball]" + } -> + file { "java-tarball": + ensure => file, + path => "/tmp/$tarball", + } } exec { "extract-java-tarball": @@ -66,4 +78,4 @@ refreshonly => true, require => File["/usr/lib/jvm/java-7-oracle"], } -} \ No newline at end of file +} From 224aa17be6df4b5d606a2f3afac41cd23a1b6661 Mon Sep 17 00:00:00 2001 From: Diego Toharia Date: Tue, 4 Jun 2013 09:34:17 +0200 Subject: [PATCH 2/3] Documented the usage of the new class parameteres --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5390ec2..5ebb1e3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,17 @@ puppet-java7 Puppet module for managing Oracle JDK 7 on Debian or Ubuntu. -Note that this module does not work out-of-the-box. You need to manually download the i586 and x64 JDK tarballs from Oracle here: +Note that this module does not work out-of-the-box. You need to manually download the i586 or x64 JDK tarballs from Oracle here: [http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html). -Both *jdk-7u5-linux-i586.tar.gz* and *jdk-7u5-linux-x64.tar.gz* need to be put in the *files* directory of this module. +By default, either *jdk-7u5-linux-i586.tar.gz* or *jdk-7u5-linux-x64.tar.gz* (depending on your architecture) need to be put in the *files* directory of this module. + +You can also configure the class with the name of the tarball, the java version to install, and the path where the JDK tarball can be found. +For example, the following configuration is used in Debian Wheeze to install the 1.7.0_21 version of the X64 JDK: + + class some_class { + class { 'java7': + version => '1.7.0_21', + tarball_name_prefix => 'jdk-7u21-linux', + jdk_path => '/var/run/puppet/java/' + } + } From f14c23b8e28db548b05906c22676c42039014806 Mon Sep 17 00:00:00 2001 From: deigote Date: Mon, 10 Jun 2013 09:18:35 +0200 Subject: [PATCH 3/3] Deleted modulefile since it wasn't working with librarian-puppet and seems to be optional --- Modulefile | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 Modulefile diff --git a/Modulefile b/Modulefile deleted file mode 100644 index c1c5cbe..0000000 --- a/Modulefile +++ /dev/null @@ -1,11 +0,0 @@ -name 'jlust-java7' -version '' -source '' -author 'jlust' -license '' -summary '' -description '' -project_page '' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0'