diff --git a/.gemfile b/.gemfile deleted file mode 100644 index 5e01bf6..0000000 --- a/.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://rubygems.org' - -puppetversion = ENV['PUPPET_VERSION'] -gem 'puppet', puppetversion, :require => false -gem 'puppet-lint' -gem 'rspec', '~> 3.1.0', :platforms => :ruby_18 -gem 'puppetlabs_spec_helper', '>= 0.1.0' 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..9f85bab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +bundler_args: --without development rvm: - 1.8.7 - 1.9.3 @@ -6,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" @@ -17,10 +17,7 @@ matrix: - rvm: 1.8.7 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" + env: PUPPET_VERSION="~> 2.7.0" - rvm: 2.1.4 env: PUPPET_VERSION="~> 2.7.0" - rvm: 2.1.4 @@ -28,7 +25,6 @@ matrix: - rvm: 2.1.4 env: PUPPET_VERSION="~> 3.1.0" -gemfile: .gemfile sudo: false notifications: email: diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..be1c34c --- /dev/null +++ b/Gemfile @@ -0,0 +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 '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/init.pp b/manifests/init.pp index 880b262..2de6b57 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,20 +34,30 @@ 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}", + '5' => "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}", + '5' => "jdk-${version}", + }, default => "java-1.${version}.0-openjdk-devel", }, default => $package_jdk, diff --git a/manifests/install.pp b/manifests/install.pp index 4a244de..31b2745 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -65,21 +65,29 @@ 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}", + '5' => "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}", + '5' => "developer/java/jdk-${version}", + }, default => fail("OperatingSystem ${::operatingsystem} not supported"), } }, diff --git a/manifests/params.pp b/manifests/params.pp index 494fd65..3da1fc3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,6 +24,11 @@ $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', + '5' => '/usr/java', + }, default => '/usr/lib/jvm', } diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..83d8604 --- /dev/null +++ b/metadata.json @@ -0,0 +1,69 @@ +{ + "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": "puppetlabs/concat", + "version_requirement": ">= 1.0.0" + } + ] +}