Skip to content

Commit

Permalink
Add ensure parameter to jenkins::slave
Browse files Browse the repository at this point in the history
Allows running the slave manually instead of a service, useful in Docker for instance
  • Loading branch information
Carlos Sanchez committed Aug 25, 2014
1 parent 8027c39 commit bd892f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
$disable_ssl_verification = false,
$labels = undef,
$install_java = $jenkins::params::install_java,
$ensure = 'running',
$enable = true
) inherits jenkins::params {

Expand Down Expand Up @@ -192,7 +193,7 @@
}

service { 'jenkins-slave':
ensure => running,
ensure => $ensure,
enable => $enable,
hasstatus => true,
hasrestart => true,
Expand Down
7 changes: 6 additions & 1 deletion spec/classes/jenkins_slave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
shared_context 'a jenkins::slave catalog' do
it { should contain_exec('get_swarm_client') }
it { should contain_file('/etc/init.d/jenkins-slave') }
it { should contain_service('jenkins-slave') }
it { should contain_service('jenkins-slave').with(:enable => true, :ensure => 'running') }
it { should contain_user('jenkins-slave_user').with_uid(nil) }
# Let the different platform blocks define `slave_runtime_file` separately below
it { should contain_file(slave_runtime_file).with_content(/-fsroot \/home\/jenkins-slave/) }
Expand All @@ -25,6 +25,11 @@
let(:params) { {:slave_home => home } }
it { should contain_file(slave_runtime_file).with_content(/-fsroot #{home}/) }
end

describe 'with service disabled' do
let(:params) { {:enable => false, :ensure => 'stopped' } }
it { should contain_service('jenkins-slave').with(:enable => false, :ensure => 'stopped') }
end
end

describe 'RedHat' do
Expand Down

0 comments on commit bd892f3

Please sign in to comment.