From bff86de71ec57e858c16012cd3acbff62d3723df Mon Sep 17 00:00:00 2001 From: Khai Do Date: Mon, 3 Mar 2014 11:44:40 -0800 Subject: [PATCH] Fix update java alternatives on redhat systems puppet was throwing the following error.. nodepool.image.build.rax-iad.bare-centos6: Could not find dependent Exec[update-java-alternatives] for Package[ant] at | /root/config/modules/jenkins/manifests/slave.pp:86 because update-java-alternatives was only defined for debian, not for redhat systems. This change adds java alternatives update to redhat. Needed to change 'java-1.7.0-openjdk' to 'java-1.7.0-openjdk-devel' because 'java-1.7.0-openjdk' does not install the javac compiler. We are setting alternatives for debian and centos but not for fedora because the java 6 packages are not available on fedora. Change-Id: I04b3e8292d3f31cd56ada9be99da8a234e13585a --- modules/jenkins/manifests/params.pp | 2 +- modules/jenkins/manifests/slave.pp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/jenkins/manifests/params.pp b/modules/jenkins/manifests/params.pp index a85c745b54..392e91c650 100644 --- a/modules/jenkins/manifests/params.pp +++ b/modules/jenkins/manifests/params.pp @@ -7,7 +7,7 @@ class jenkins::params { 'RedHat': { #yum groupinstall "Development Tools" # common packages - $jdk_package = 'java-1.7.0-openjdk' + $jdk_package = 'java-1.7.0-openjdk-devel' $ccache_package = 'ccache' $python_netaddr_package = 'python-netaddr' # packages needed by slaves diff --git a/modules/jenkins/manifests/slave.pp b/modules/jenkins/manifests/slave.pp index 803eb58c0f..c7472772d3 100644 --- a/modules/jenkins/manifests/slave.pp +++ b/modules/jenkins/manifests/slave.pp @@ -21,6 +21,8 @@ class jenkins::slave( } } + anchor { 'jenkins::slave::update-java-alternatives': } + # Packages that all jenkins slaves need $common_packages = [ $::jenkins::params::jdk_package, # jdk for building java jobs @@ -82,7 +84,7 @@ class jenkins::slave( package { $packages: ensure => present, - before => Exec['update-java-alternatives'] + before => Anchor['jenkins::slave::update-java-alternatives'] } case $::osfamily { @@ -103,6 +105,12 @@ class jenkins::slave( package { $::jenkins::params::mysql_package: ensure => present, } + } else { + exec { 'update-java-alternatives': + unless => '/bin/ls -l /etc/alternatives/java | /bin/grep 1.7.0-openjdk', + command => '/usr/sbin/alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java && /usr/sbin/alternatives --set javac /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/javac', + require => Anchor['jenkins::slave::update-java-alternatives'] + } } } 'Debian': { @@ -147,6 +155,7 @@ class jenkins::slave( exec { 'update-java-alternatives': unless => '/bin/ls -l /etc/alternatives/java | /bin/grep java-7-openjdk-amd64', command => '/usr/sbin/update-java-alternatives --set java-1.7.0-openjdk-amd64', + require => Anchor['jenkins::slave::update-java-alternatives'] } }