Make ssh_key parameter optional

The main reason to do this is for CI. We don't want to overwrite the
real jenkins user's SSH authorized keys, but we still want to test
everything else about the jenkinsuser class, so allow the ssh_key
parameter to be empty and don't overwrite authorized_keys if it is.

Change-Id: Ic2c12940767d53928fa07170c32f34619019287c
This commit is contained in:
Colleen Murphy 2017-06-10 20:22:56 +02:00
parent 3f2c0a65aa
commit 275e22f63f
2 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
# == Class: jenkins::jenkinsuser
#
class jenkins::jenkinsuser(
$ssh_key,
$ssh_key = undef,
$ensure = present,
$gitfullname = 'OpenStack Jenkins',
$gitemail = 'jenkins@openstack.org',
@ -58,14 +58,15 @@ class jenkins::jenkinsuser(
require => File['/home/jenkins'],
}
# cleanup old content in directory
file { '/home/jenkins/.ssh/authorized_keys':
ensure => 'file',
owner => 'jenkins',
group => 'jenkins',
mode => '0600',
content => template('jenkins/authorized_keys.erb'),
require => File['/home/jenkins/.ssh'],
if $ssh_key != undef {
file { '/home/jenkins/.ssh/authorized_keys':
ensure => 'file',
owner => 'jenkins',
group => 'jenkins',
mode => '0600',
content => template('jenkins/authorized_keys.erb'),
require => File['/home/jenkins/.ssh'],
}
}
if $gerritkey != undef {

View File

@ -1,7 +1,7 @@
# == Class: jenkins::slave
#
class jenkins::slave(
$ssh_key,
$ssh_key = undef,
$user = true,
$gitfullname = 'OpenStack Jenkins',
$gitemail = 'jenkins@openstack.org',