-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from willaerk/user_hash
Add jenkins::users class to declare all users
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ | |
# config_hash => { | ||
# 'HTTP_PORT' => { 'value' => '9090' }, 'AJP_PORT' => { 'value' => '9009' } | ||
# } | ||
# V | ||
# } | ||
# | ||
# plugin_hash = undef (Default) | ||
# Hash with config plugins to install | ||
|
@@ -81,6 +81,23 @@ | |
# 'token-macro': {} | ||
# | ||
# | ||
# user_hash = {} (Default) | ||
# Hash with users to create in jenkins | ||
# | ||
# Example use | ||
# | ||
# class{ 'jenkins': | ||
# user_hash => { | ||
# 'user1' => { 'password' => 'pass1', | ||
# 'email' => '[email protected]'} | ||
# | ||
# Or in Hiera | ||
# | ||
# jenkins::user_hash: | ||
# 'user1': | ||
# password: 'pass1' | ||
# email: '[email protected]' | ||
# | ||
# configure_firewall = undef (default) | ||
# For folks that want to manage the puppetlabs firewall module. | ||
# - If it's not present in the catalog, nothing happens. | ||
|
@@ -133,6 +150,7 @@ | |
$config_hash = {}, | ||
$plugin_hash = {}, | ||
$job_hash = {}, | ||
$user_hash = {}, | ||
$configure_firewall = undef, | ||
$install_java = $jenkins::params::install_java, | ||
$proxy_host = undef, | ||
|
@@ -187,6 +205,7 @@ | |
include jenkins::config | ||
include jenkins::plugins | ||
include jenkins::jobs | ||
include jenkins::users | ||
|
||
if $proxy_host and $proxy_port { | ||
class { 'jenkins::proxy': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Class: jenkins::users | ||
# | ||
class jenkins::users { | ||
|
||
if $caller_module_name != $module_name { | ||
fail("Use of private class ${name} by ${caller_module_name}") | ||
} | ||
|
||
create_resources('jenkins::user', $::jenkins::user_hash) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe 'jenkins', :type => :module do | ||
let(:facts) { { :osfamily => 'RedHat', :operatingsystem => 'RedHat' } } | ||
|
||
context 'users' do | ||
context 'default' do | ||
it { should contain_class('jenkins::users') } | ||
end | ||
|
||
context 'with testuser' do | ||
let(:params) { | ||
{ :user_hash => { 'user' => { | ||
'email' => '[email protected]', | ||
'password' => 'test' | ||
} } } } | ||
it { should contain_jenkins__user('user').with_email('[email protected]').with_password('test') } | ||
end | ||
|
||
end | ||
|
||
end |