From e3f67e7941c0d4bd44ff9e7fb38e4a397ffcd78f Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Sun, 11 Jun 2017 16:21:00 +0200 Subject: [PATCH] Use the default jenkins password for JJB This module does not create a jenkins user within jenkins, so there is no way its password could have been set to 'secret'. Trying to use this as JJB's auth credentials was causing the JJB exec to fail. This patch grabs the default admin password out of /var and uses that for JJB. Change-Id: Ifa60398acbc494dcfecd0cabaa8c829590c1744e --- spec/acceptance/fixtures/slave.pp | 4 ++-- spec/acceptance/slave_spec.rb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/acceptance/fixtures/slave.pp b/spec/acceptance/fixtures/slave.pp index c997da6..8caf1db 100644 --- a/spec/acceptance/fixtures/slave.pp +++ b/spec/acceptance/fixtures/slave.pp @@ -4,8 +4,8 @@ class { '::jenkins::slave': class { '::jenkins::job_builder': url => "https://${::fqdn}", - username => 'jenkins', - password => 'secret', + username => 'admin', + password => '<>', jenkins_jobs_update_timeout => 1200, config_dir => '/etc/project-config/jenkins', require => Class['::jenkins::slave'], diff --git a/spec/acceptance/slave_spec.rb b/spec/acceptance/slave_spec.rb index c2e5e64..694f6ce 100644 --- a/spec/acceptance/slave_spec.rb +++ b/spec/acceptance/slave_spec.rb @@ -11,9 +11,13 @@ describe 'puppet-jenkins slave module', :if => ['debian', 'ubuntu'].include?(os[ File.read(module_path) end + def default_password + command('/bin/cat /var/lib/jenkins/secrets/initialAdminPassword').stdout.chomp + end + def jenkins_slave_puppet_module module_path = File.join(pp_path, 'slave.pp') - File.read(module_path) + File.read(module_path).gsub('<>', default_password) end before(:all) do