Skip to content

Commit

Permalink
Avoid attempting to install Java on Darwin which puppetlabs/java does…
Browse files Browse the repository at this point in the history
…n't support
  • Loading branch information
R. Tyler Croy committed Aug 15, 2015
1 parent eab3d54 commit fa47ad6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
10 changes: 6 additions & 4 deletions manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@
$client_jar = "swarm-client-${version}-jar-with-dependencies.jar"
$client_url = "http://maven.jenkins-ci.org/content/repositories/releases/org/jenkins-ci/plugins/swarm-client/${version}/"

if $install_java {
if $install_java and ($::osfamily != 'Darwin') {
# Currently the puppetlabs/java module doesn't support installing Java on
# Darwin
class { 'java':
distribution => 'jdk',
}
}

# customizations based on the OS family
# customizations based on the OS family
case $::osfamily {
'Debian': {
$defaults_location = '/etc/default'
Expand Down Expand Up @@ -184,7 +186,7 @@
default: { }
}

#add jenkins slave user if necessary.
#a Add jenkins slave user if necessary.
if $manage_slave_user {
user { 'jenkins-slave_user':
ensure => present,
Expand Down Expand Up @@ -226,7 +228,7 @@
Exec['get_swarm_client']
-> Service['jenkins-slave']

if $install_java {
if $install_java and ($::osfamily != 'Darwin') {
Class['java'] ->
Service['jenkins-slave']
}
Expand Down
31 changes: 19 additions & 12 deletions spec/classes/jenkins_slave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,25 @@
end
end

# describe 'Darwin' do
# let(:facts) { { :osfamily => 'Darwin', :operatingsystem => 'Darwin', :kernel => 'Darwin' } }
# let(:slave_runtime_file) { '/home/jenkins-slave/jenkins-slave' }
# let(:slave_service_file) { '/Library/LaunchDaemons/org.jenkins-ci.slave.jnlp.plist' }
#
# it_behaves_like 'a jenkins::slave catalog'
#
# describe 'with slave_name' do
# let(:params) { { :slave_name => 'jenkins-slave' } }
# it_behaves_like 'using slave_name'
# end
# end
describe 'Darwin' do
let(:facts) {
{:osfamily => 'Darwin',
:operatingsystem => 'Darwin',
:kernel => 'Darwin'
}
}
let(:home) { '/home/jenkins-slave' }
let(:slave_runtime_file) { "#{home}/jenkins-slave" }
let(:slave_service_file) { '/Library/LaunchDaemons/org.jenkins-ci.slave.jnlp.plist' }

it_behaves_like 'a jenkins::slave catalog'

# NOTE: pending because jenkins-slave doesn't get installed on Darwin
describe 'with slave_name' do
let(:params) { { :slave_name => 'jenkins-slave' } }
it_behaves_like 'using slave_name'
end
end

describe 'Unknown' do
let(:facts) { { :ostype => 'Unknown' } }
Expand Down

0 comments on commit fa47ad6

Please sign in to comment.