From 75939fffc9f408c661b56a87c66f72945da07bba Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Mar 2017 11:22:14 +0200 Subject: [PATCH 1/7] fix headlines in markdown --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 836e363..8598368 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # java -#### Table of Contents +## Table of Contents 1. [Overview](#overview) 2. [Module Description - What the module does and why it is useful](#module-description) From 920748cf0a1e16dab66a7ff228a2eda148ed2d1c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Mar 2017 11:23:26 +0200 Subject: [PATCH 2/7] purge trailing whitespace --- README.markdown | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.markdown b/README.markdown index 8598368..4937a22 100644 --- a/README.markdown +++ b/README.markdown @@ -13,7 +13,7 @@ ## Overview -Installs the correct Java package on various platforms. +Installs the correct Java package on various platforms. ## Module Description @@ -34,7 +34,7 @@ class { 'java': } ~~~ -To install the latest patch version of Java 8 on CentOS +To install the latest patch version of Java 8 on CentOS ~~~ class { 'java' : @@ -88,23 +88,23 @@ java::oracle { 'jdk8' : The following parameters are available in `java`: ##### `distribution` -Specifies the Java distribution to install. +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'. ##### `java_alternative` -Specifies the name of the Java alternative to use. If you set this parameter, *you must also set the `java_alternative_path`.* +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. -##### `java_alternative_path` -*Required when `java_alternative` is specified.* Defines the path to the `java` command. +##### `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. ##### `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 installs the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter does nothing. -Valid option: String. Default: undef. +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 installs the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter does nothing. +Valid option: String. Default: undef. ##### `version` -Sets the version of Java to install, if you want to ensure a particular 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'. #### Public defined types @@ -153,7 +153,7 @@ The java module includes a few facts to describe the version of Java installed o ## Limitations -This module cannot guarantee installation of Java versions that are not available on platform repositories. +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. @@ -161,7 +161,7 @@ Oracle Java packages are not included in Debian 7 and Ubuntu 12.04/14.04 reposit 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 @@ -173,7 +173,7 @@ OpenJDK is supported on: * SLES 11 SP1, SP2, SP3, SP4; SLES 12, SP1, SP2 * OpenBSD 5.6, 5.7 -Sun Java is supported on: +Sun Java is supported on: * Debian 6 From 4f7d760f106d209580756e12b6fe90bd24d3dda5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Mar 2017 11:25:23 +0200 Subject: [PATCH 3/7] use proper syntax highlighting in markdown --- README.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index 4937a22..6a7f7e7 100644 --- a/README.markdown +++ b/README.markdown @@ -28,23 +28,23 @@ 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 installs 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: -~~~ +```puppet class { 'java': distribution => 'jre', } -~~~ +``` To install the latest patch version of Java 8 on CentOS -~~~ +```puppet class { 'java' : package => 'java-1.8.0-openjdk-devel', } -~~~ +``` 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. -~~~ +```puppet java::oracle { 'jdk6' : ensure => 'present', version => '6', @@ -56,18 +56,18 @@ java::oracle { 'jdk8' : 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', } -~~~ +``` ## Reference From 585bd5795e15fd8991b66506ee85c1360b9217bd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Mar 2017 11:26:32 +0200 Subject: [PATCH 4/7] bump stdlib to recommended puppet4 version --- metadata.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index eeb2b4a..0ece972 100644 --- a/metadata.json +++ b/metadata.json @@ -89,7 +89,13 @@ } ], "dependencies": [ - {"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0 < 5.0.0"}, - {"name":"puppet/archive","version_requirement":">= 1.1.0 < 2.0.0"} + { + "name":"puppetlabs/stdlib", + "version_requirement": ">= 4.13.1 < 5.0.0" + }, + { + "name":"puppet/archive", + "version_requirement": ">= 1.1.0 < 2.0.0" + } ] } From 66662bf4e9e84d952fb9ae26620a96f82b662471 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Mar 2017 11:28:59 +0200 Subject: [PATCH 5/7] replace validate_* calls with datatypes --- manifests/init.pp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2a8efd6..0c97e4a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,22 +46,16 @@ # Sample Usage: # class java( - $distribution = 'jdk', - $version = 'present', - $package = undef, - $package_options = undef, - $java_alternative = undef, - $java_alternative_path = undef, - $java_home = undef + String $distribution = 'jdk', + Pattern[/present|installed|latest|^[.+_0-9a-zA-Z:~-]+$/] $version = 'present', + $package = undef, + Optional[Array] $package_options = undef, + $java_alternative = undef, + $java_alternative_path = undef, + $java_home = undef ) { include java::params - validate_re($version, 'present|installed|latest|^[.+_0-9a-zA-Z:~-]+$') - - if $package_options != undef { - validate_array($package_options) - } - if has_key($java::params::java, $distribution) { $default_package_name = $java::params::java[$distribution]['package'] $default_alternative = $java::params::java[$distribution]['alternative'] From 3dacc7abe530aac51dcb6f1520891a2116f35807 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 7 Jun 2017 19:58:50 +0200 Subject: [PATCH 6/7] fix markdown linter warnings --- README.markdown | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 6a7f7e7..f866e7e 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # java -## Table of Contents +#### Table of Contents 1. [Overview](#overview) 2. [Module Description - What the module does and why it is useful](#module-description) @@ -22,6 +22,7 @@ The java module can automatically install Java jdk or jre on a wide variety of s ## Setup ### Beginning with the java module + To install the correct Java package on your system, include the `java` class: `include java`. ## Usage @@ -85,25 +86,31 @@ java::oracle { 'jdk8' : #### Parameters + The following parameters are available in `java`: ##### `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'. ##### `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. ##### `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. ##### `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 installs the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter does 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'. @@ -119,24 +126,31 @@ The following parameters are available in `java::oracle`: Version of Java Standard Edition (SE) to install. 6, 7 or 8. ##### `version_major` + Major version of the Java Standard Edition (SE) to install. Must be used together with `version_minor`. For example, '8u101'. ##### `version_minor` + Minor version (or build version) of the Java Standard Edition (SE) to install. Must be used together with `version_major`. For example, 'b13'. ##### `java_se` + Type of Java SE to install, jdk or jre. ##### `ensure` + Install or remove the package. ##### `oracle_url` + Official Oracle URL to download the binaries from. ##### `proxy_server` + Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive) ##### `proxy_type` + Proxy server type (none|http|https|ftp). (passed to archive) ### Facts @@ -178,6 +192,7 @@ Sun Java is supported on: * Debian 6 Oracle Java is supported on: + * CentOS 6 ### Known issues From cf1411664164da2263db95a1af65a91ba5319054 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 7 Jun 2017 23:28:06 +0200 Subject: [PATCH 7/7] add datatypes for all parameters --- manifests/init.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0c97e4a..2a9a7d9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -48,11 +48,11 @@ class java( String $distribution = 'jdk', Pattern[/present|installed|latest|^[.+_0-9a-zA-Z:~-]+$/] $version = 'present', - $package = undef, + Optional[String] $package = undef, Optional[Array] $package_options = undef, - $java_alternative = undef, - $java_alternative_path = undef, - $java_home = undef + Optional[String] $java_alternative = undef, + Optional[String] $java_alternative_path = undef, + Optional[String] $java_home = undef ) { include java::params