From 3739abb1cefa68079068eb5a66fe3d81660e3281 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 31 Mar 2016 12:42:00 +0200 Subject: [PATCH 1/9] Add Solaris support move from .gemfile to Gemfile add metadata.json --- .gitignore | 2 +- .travis.yml | 1 - .gemfile => Gemfile | 0 manifests/init.pp | 12 +++++-- manifests/install.pp | 16 ++++++--- manifests/params.pp | 4 +++ metadata.json | 81 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 107 insertions(+), 9 deletions(-) rename .gemfile => Gemfile (100%) create mode 100644 metadata.json diff --git a/.gitignore b/.gitignore index d8a6152..72a2c78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /.gradle -/metadata.json /.rvmrc build pkg/ @@ -10,3 +9,4 @@ spec/fixtures .bundle vendor .gemfile.lock +Gemfile.lock diff --git a/.travis.yml b/.travis.yml index 297f6ec..d6e4ab4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ matrix: - rvm: 2.1.4 env: PUPPET_VERSION="~> 3.1.0" -gemfile: .gemfile sudo: false notifications: email: diff --git a/.gemfile b/Gemfile similarity index 100% rename from .gemfile rename to Gemfile diff --git a/manifests/init.pp b/manifests/init.pp index 880b262..1b0c7e6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,20 +34,28 @@ default => '', } $real_package = $package ? { - '' => $::operatingsystem ? { + '' => $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => "openjdk-${version}-jre${headless_suffix}", /(?i:SLES)/ => "java-1_${version}_0-ibm", /(?i:OpenSuSE)/ => "java-1_${version}_0-openjdk", + /(?i:Solaris)/ => $::operatingsystemmajrelease ? { + '10' => "CSWjre${version}", + '11' => "jre-${version}", + }, default => "java-1.${version}.0-openjdk", }, default => $package, } $real_package_jdk = $package_jdk ? { - '' => $::operatingsystem ? { + '' => $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => "openjdk-${version}-jdk", /(?i:SLES)/ => "java-1_${version}_0-ibm", /(?i:OpenSuSE)/ => "java-1_${version}_0-openjdk-devel", + /(?i:Solaris)/ => $::operatingsystemmajrelease ? { + '10' => "CSWjdk${version}", + '11' => "jdk${version}", + }, default => "java-1.${version}.0-openjdk-devel", }, default => $package_jdk, diff --git a/manifests/install.pp b/manifests/install.pp index 4a244de..f2f3a7e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -65,21 +65,27 @@ default => '', } $real_package = $package ? { - '' => $bool_jdk ? { - false => $::operatingsystem ? { + '' => $bool_jdk ? { + false => $::operatingsystem ? { /(?i:RedHat|Centos|Fedora|Scientific|Amazon|Linux)/ => "java-1.${version}.0-openjdk", /(?i:Ubuntu|Debian|Mint)/ => "openjdk-${version}-jre${headless_suffix}", /(?i:SLES)/ => "java-1_${version}_0-ibm", /(?i:OpenSuSE)/ => "java-1_${version}_0-openjdk", - /(?i:Solaris)/ => "runtime/java/jre-${version}", + /(?i:Solaris)/ => $::operatingsystemmajrelease ? { + '10' => "CSWjre${version}", + '11' => "runtime/java/jre-${version}", + }, default => fail("OperatingSystem ${::operatingsystem} not supported"), }, - true => $::operatingsystem ? { + true => $::operatingsystem ? { /(?i:RedHat|Centos|Fedora|Scientific|Amazon|Linux)/ => "java-1.${version}.0-openjdk-devel", /(?i:Ubuntu|Debian|Mint)/ => "openjdk-${version}-jdk", /(?i:SLES)/ => "java-1_${version}_0-ibm", /(?i:OpenSuSE)/ => "java-1_${version}_0-openjdk-devel", - /(?i:Solaris)/ => "developer/java/jdk-${version}", + /(?i:Solaris)/ => $::operatingsystemmajrelease ? { + '10' => "CSWjdk${version}", + '11' => "developer/java/jdk-${version}", + }, default => fail("OperatingSystem ${::operatingsystem} not supported"), } }, diff --git a/manifests/params.pp b/manifests/params.pp index 494fd65..5539200 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,6 +24,10 @@ $java_home_base = $::operatingsystem ? { /(?i:SLES|OpenSuSE)/ => '/usr/lib/java', /(?i:Ubuntu|Debian|Mint)/ => '/usr/lib/jvm', + /(?i:Solaris)/ => $::operatingsystemmajrelease ? { + '10' => '/opt/csw/java', + '11' => '/usr/java', + }, default => '/usr/lib/jvm', } diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..1b73226 --- /dev/null +++ b/metadata.json @@ -0,0 +1,81 @@ +{ + "name": "example42-java", + "version": "2.1.0", + "summary": "Puppet module to manage Java", + "license": "Apache-2.0", + "author": "Alessandro Franceschi, Martin Alfke", + "checksums": { + }, + "source": "https://github.com/example42/puppet-java", + "project_page": "https://github.com/example42/puppet-java", + "issues_url": "https://github.com/example42/puppet-java/issues", + "operatingsystem_support": [ + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Centos", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "14.04" + ] + }, + { + "operatingsystem": "Solaris", + "operatingsystemrelease": [ + "10", + "11" + ] + } + ], + "requirements": [ + { + "name": "pe", + "version_requirement": ">= 3.0.0 < 5.0.0" + }, + { + "name": "puppet", + "version_requirement": ">= 3.0.0 < 5.0.0" + } + ], + "dependencies": [ + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 3.2.0 < 5.0.0" + }, + { + "name": "example42/puppi", + "version_requirement": ">= 2.0.0" + }, + { + "name": "example42/monitor", + "version_requirement": ">= 2.0.0" + }, + { + "name": "example42/iptables", + "version_requirement": ">= 2.0.0" + }, + { + "name": "example42/firewall", + "version_requirement": ">= 2.0.0" + }, + { + "name": "puppetlabs/concat", + "version_requirement": ">= 1.0.0" + } + ] +} From 85dbaeb37aa2ff385d1982656f64a9196ea7f117 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 14:22:19 +0200 Subject: [PATCH 2/9] Add readme content use gemfile from puppet-network pin rake and rapes on ruby 1.8 add matcher for OpenIndiana --- Gemfile | 14 +++++++++++++- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ manifests/params.pp | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5e01bf6..be1c34c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,19 @@ source 'https://rubygems.org' puppetversion = ENV['PUPPET_VERSION'] + +is_ruby18 = RUBY_VERSION.start_with? '1.8' + +if is_ruby18 + gem 'rspec', "~> 3.1.0", :require => false + gem 'rake', '~> 10.5.0', :require => false +end gem 'puppet', puppetversion, :require => false gem 'puppet-lint' -gem 'rspec', '~> 3.1.0', :platforms => :ruby_18 gem 'puppetlabs_spec_helper', '>= 0.1.0' +gem 'rspec-puppet' +gem 'metadata-json-lint' + +group :development do + gem 'puppet-blacksmith' +end diff --git a/README.md b/README.md index e69de29..6c6ddad 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,45 @@ +#java + +[![Build Status](https://travis-ci.org/example42/puppet-java.png?branch=master)](https://travis-ci.org/example42/puppet-java) + +####Table of Contents + +1. [Overview](#overview) +2. [Setup](#setup) +3. [Usage](#usage) + + +##Overview + +This module installs java (JDK + JRE) versions + +##Setup + +###Setup Requirements +* PuppetLabs [stdlib module](https://github.com/puppetlabs/puppetlabs-stdlib) +* Example42 [puppet module](https://github.com/example42/puppi) + +##Usage + +The main class is used only. + + class { 'java': + jdk => false, # default - whether to install the jdk or the jre only + version => '6', # Java version to install + } + +##Development + +Pull requests (PR) and bug reports via GitHub are welcomed. + +When submitting PR please follow these quidelines: +- Provide puppet-lint compliant code +- If possible provide rspec tests +- Follow the module style and stdmod naming standards + +When submitting bug report please include or link: +- The Puppet code that triggers the error +- The output of facter on the system where you try it +- All the relevant error logs +- Any other information useful to undestand the context + diff --git a/manifests/params.pp b/manifests/params.pp index 5539200..3da1fc3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,6 +27,7 @@ /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => '/opt/csw/java', '11' => '/usr/java', + '5' => '/usr/java', }, default => '/usr/lib/jvm', } From 06e0a5340a0e1e8eb70de42ae598b5b1514fe1bf Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 14:25:36 +0200 Subject: [PATCH 3/9] add OpenIndiana matcher --- manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 1b0c7e6..301f10f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -41,6 +41,7 @@ /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => "CSWjre${version}", '11' => "jre-${version}", + '5' => "jre-${version}", }, default => "java-1.${version}.0-openjdk", }, @@ -55,6 +56,7 @@ /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => "CSWjdk${version}", '11' => "jdk${version}", + '5' => "jdk${version}", }, default => "java-1.${version}.0-openjdk-devel", }, From 2ccb388481849925ba94814a8849e72078f86aff Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 14:35:03 +0200 Subject: [PATCH 4/9] use proper jdk package name on solaris --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 301f10f..2de6b57 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -55,8 +55,8 @@ /(?i:OpenSuSE)/ => "java-1_${version}_0-openjdk-devel", /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => "CSWjdk${version}", - '11' => "jdk${version}", - '5' => "jdk${version}", + '11' => "jdk-${version}", + '5' => "jdk-${version}", }, default => "java-1.${version}.0-openjdk-devel", }, From 9104e9650216cea687fc64e22c433eaf25f8aa5c Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 6 Apr 2016 08:13:04 +0200 Subject: [PATCH 5/9] add OpenIndiana version --- manifests/install.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/install.pp b/manifests/install.pp index f2f3a7e..31b2745 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -74,6 +74,7 @@ /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => "CSWjre${version}", '11' => "runtime/java/jre-${version}", + '5' => "runtime/java/jre-${version}", }, default => fail("OperatingSystem ${::operatingsystem} not supported"), }, @@ -85,6 +86,7 @@ /(?i:Solaris)/ => $::operatingsystemmajrelease ? { '10' => "CSWjdk${version}", '11' => "developer/java/jdk-${version}", + '5' => "developer/java/jdk-${version}", }, default => fail("OperatingSystem ${::operatingsystem} not supported"), } From dee170a98d282fe89eeb71a436679ed0f0e82e19 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 6 Apr 2016 08:18:45 +0200 Subject: [PATCH 6/9] run travis without development this willallow ruby 1.8 tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d6e4ab4..31e16d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +bundler_args: --without development rvm: - 1.8.7 - 1.9.3 @@ -18,7 +19,6 @@ matrix: env: PUPPET_VERSION="~> 4.2" - rvm: 1.9.3 env: PUPPET_VERSION="~> 2.6.0" - gemfile: .gemfile - rvm: 2.1.4 env: PUPPET_VERSION="~> 2.6.0" - rvm: 2.1.4 From acdcb6299534eaff502cbf7b986fd1c553f59cc7 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 6 Apr 2016 10:41:30 +0200 Subject: [PATCH 7/9] removing tests with puppet 2.6 --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31e16d6..507b47a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ rvm: script: - "bundle exec rake lint spec SPEC_OPTS='--format documentation'" env: - - PUPPET_VERSION="~> 2.6.0" - PUPPET_VERSION="~> 2.7.0" - PUPPET_VERSION="~> 3.0.0" - PUPPET_VERSION="~> 3.1.0" @@ -18,10 +17,6 @@ matrix: - rvm: 1.8.7 env: PUPPET_VERSION="~> 4.2" - rvm: 1.9.3 - env: PUPPET_VERSION="~> 2.6.0" - - rvm: 2.1.4 - env: PUPPET_VERSION="~> 2.6.0" - - rvm: 2.1.4 env: PUPPET_VERSION="~> 2.7.0" - rvm: 2.1.4 env: PUPPET_VERSION="~> 3.0.0" From b801b4d14b2a972e6b5f2d466675df50d00f7478 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 6 Apr 2016 11:00:34 +0200 Subject: [PATCH 8/9] dont run tests with puppet 2.7 on ruby 2.1 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 507b47a..9f85bab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,8 @@ matrix: env: PUPPET_VERSION="~> 4.2" - rvm: 1.9.3 env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.1.4 + env: PUPPET_VERSION="~> 2.7.0" - rvm: 2.1.4 env: PUPPET_VERSION="~> 3.0.0" - rvm: 2.1.4 From 81a3ee7f8a1688c0896aee65c934c9f4b5569996 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 7 Apr 2016 18:01:48 +0200 Subject: [PATCH 9/9] remove optional example42 modules from metadata.json --- metadata.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/metadata.json b/metadata.json index 1b73226..83d8604 100644 --- a/metadata.json +++ b/metadata.json @@ -61,18 +61,6 @@ "name": "example42/puppi", "version_requirement": ">= 2.0.0" }, - { - "name": "example42/monitor", - "version_requirement": ">= 2.0.0" - }, - { - "name": "example42/iptables", - "version_requirement": ">= 2.0.0" - }, - { - "name": "example42/firewall", - "version_requirement": ">= 2.0.0" - }, { "name": "puppetlabs/concat", "version_requirement": ">= 1.0.0"