Skip to content

Commit

Permalink
Allow disabling clients unique ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterzo committed Oct 12, 2016
1 parent 037a591 commit 95987fb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 24 deletions.
51 changes: 28 additions & 23 deletions manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
# Disable SSL certificate verification on Swarm clients. Not required, but is necessary if you're using a self-signed SSL cert.
# Defaults to false.
#
# [*disable_clients_unique_id*]
# Disable setting the unique id for the swarm client
# Defaults to false
#
# [*labels*]
# Not required. String, or Array, that contains the list of labels to be assigned for this slave.
#
Expand Down Expand Up @@ -103,30 +107,31 @@
#
# Copyright 2013 Matthew Barr , but can be used for anything by anyone..
class jenkins::slave (
$slave_name = undef,
$description = undef,
$masterurl = undef,
$autodiscoveryaddress = undef,
$ui_user = undef,
$ui_pass = undef,
$version = $jenkins::params::swarm_version,
$executors = 2,
$manage_slave_user = true,
$slave_user = 'jenkins-slave',
$slave_groups = undef,
$slave_uid = undef,
$slave_home = '/home/jenkins-slave',
$slave_mode = 'normal',
$slave_name = undef,
$description = undef,
$masterurl = undef,
$autodiscoveryaddress = undef,
$ui_user = undef,
$ui_pass = undef,
$version = $jenkins::params::swarm_version,
$executors = 2,
$manage_slave_user = true,
$slave_user = 'jenkins-slave',
$slave_groups = undef,
$slave_uid = undef,
$slave_home = '/home/jenkins-slave',
$slave_mode = 'normal',
$disable_ssl_verification = false,
$labels = undef,
$tool_locations = undef,
$install_java = $jenkins::params::install_java,
$manage_client_jar = true,
$ensure = 'running',
$enable = true,
$source = undef,
$java_args = undef,
$proxy_server = undef,
$disable_clients_unique_id = false,
$labels = undef,
$tool_locations = undef,
$install_java = $jenkins::params::install_java,
$manage_client_jar = true,
$ensure = 'running',
$enable = true,
$source = undef,
$java_args = undef,
$proxy_server = undef,
) inherits jenkins::params {
validate_string($slave_name)
validate_string($description)
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/jenkins_slave_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@
should contain_file(slave_runtime_file).with_content(/^LABELS="unlimited blades"$/)
end
end
describe 'disable unique client id' do
let(:params) do
{
:disable_clients_unique_id => true
}
end
it 'should have disable variable' do
should contain_file(slave_runtime_file)
.with_content(/^DISABLE_UNIQUE="-disableClientsUniqueId"$/)
should contain_file(slave_runtime_file)
.with_content(/^JENKINS_SLAVE_ARGS=".*\s\$DISABLE_UNIQUE(.*)"$/)
end
end
end

shared_examples 'using slave_name' do
Expand Down
3 changes: 2 additions & 1 deletion templates/jenkins-slave-defaults.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ JENKINS_USERNAME=<%= @quoted_ui_user %>
JENKINS_PASSWORD=<%= @quoted_ui_pass %>

OTHER_ARGS="<%= '-disableSslVerification' if @disable_ssl_verification -%>"
DISABLE_UNIQUE="<%= '-disableClientsUniqueId' if @disable_clients_unique_id -%>"

if [ -n "$JENKINS_USERNAME" ]; then
CREDENTIALS_ARG="-username $JENKINS_USERNAME -password $JENKINS_PASSWORD"
Expand Down Expand Up @@ -96,4 +97,4 @@ if [ -n "$AUTO_DISCOVERY_ADDRESS" ]; then
AUTO_DISCOVERY_ADDRESS_ARG="-autoDiscoveryAddress '$AUTO_DISCOVERY_ADDRESS'"
fi

JENKINS_SLAVE_ARGS="-mode $JENKINS_SLAVE_MODE -executors $EXECUTORS $CREDENTIALS_ARG $NAME_ARG $MASTER_URL_ARG $LABELS_ARG $FSROOT_ARG $AUTO_DISCOVERY_ADDRESS_ARG $TOOL_LOCATIONS_ARG $DESCRIPTION_ARG $OTHER_ARGS"
JENKINS_SLAVE_ARGS="-mode $JENKINS_SLAVE_MODE -executors $EXECUTORS $CREDENTIALS_ARG $NAME_ARG $MASTER_URL_ARG $LABELS_ARG $FSROOT_ARG $AUTO_DISCOVERY_ADDRESS_ARG $TOOL_LOCATIONS_ARG $DESCRIPTION_ARG $OTHER_ARGS $DISABLE_UNIQUE"

0 comments on commit 95987fb

Please sign in to comment.