Skip to content

Commit

Permalink
Fix Could not find group jenkins error
Browse files Browse the repository at this point in the history
Without this patch applied, the Jenkins module fails on Lucid when
managing a jenkins::plugin::install resource.  This is a problem because
the catalog cannot compile and the system is not configured.

The error looks like:

    err: /Stage[main]/Site::Jenkins_plugins/Jenkins::Plugin::Install[git]/File[/var/lib/jenkins]:
        Could not evaluate: Could not find group jenkins

This error is caused because the file resource specfies group =>
jenkins, but the defined type does not manage a Group[jenkins] resource,
only a User[jenkins] resource.

This patch fixes the problem by managing Group[jenkins] similar to how
User[jenkins] is already managed.

This fixes the issue and adds rspec-puppet tests to cover the common
resource of Jenkins::Plugin::Install[git]
  • Loading branch information
Jeff McCune committed Apr 11, 2012
1 parent 4ef0046 commit 5d8747c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion manifests/plugin/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
}
}

if (!defined(Group['jenkins'])) {
group {
'jenkins' :
ensure => present;
}
}
if (!defined(User['jenkins'])) {
user {
'jenkins' :
ensure => present;
ensure => present,
gid => 'jenkins';
}
}

Expand Down
13 changes: 13 additions & 0 deletions spec/defines/jenkins_plugin_install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

# Note, rspec-puppet determines the define name from the top level describe
# string.
describe 'jenkins::plugin::install' do
let(:title) { 'git' }
it { should contain_user('jenkins') }
it { should contain_group('jenkins') }
it { should contain_file('/var/lib/jenkins') }
it { should contain_file('/var/lib/jenkins/plugins') }
it { should contain_exec('download-git') }
end

0 comments on commit 5d8747c

Please sign in to comment.