Set reasonable defaults for reviewday::site

Empty string is not an appropriate default value for parameters that
are used unconditionally in the puppet manifest or template. For
example, the name of the http root directory cannot be an empty string,
so it is not sensible to use empty string as a default. This patch
attempts to set reasonable defaults for every parameter. For the key
parameters, we change the default from empty string to undef and update
the conditional logic related to those parameters.

Change-Id: I6d2e7037385a4082726e5e7db93b18a92b4a8ace
This commit is contained in:
Colleen Murphy 2015-08-13 17:49:05 -07:00
parent b445a0968c
commit c006a4e12e

View File

@ -15,15 +15,15 @@
# == Define: reviewday # == Define: reviewday
# #
define reviewday::site( define reviewday::site(
$gerrit_url = '', $gerrit_url = 'localhost',
$gerrit_port = '', $gerrit_port = '29418',
$gerrit_user = '', $gerrit_user = 'reviewday',
$reviewday_rsa_key_contents = '', $reviewday_rsa_key_contents = undef,
$reviewday_rsa_pubkey_contents = '', $reviewday_rsa_pubkey_contents = undef,
$reviewday_gerrit_ssh_key = '', $reviewday_gerrit_ssh_key = undef,
$git_url = '', $git_url = 'git://git.openstack.org/openstack-infra/reviewday',
$httproot = '', $httproot = '/srv/static/reviewday',
$serveradmin = '' $serveradmin = 'webmaster@example.org'
) { ) {
file { '/var/lib/reviewday/.ssh/': file { '/var/lib/reviewday/.ssh/':
@ -34,7 +34,7 @@ define reviewday::site(
require => User['reviewday'], require => User['reviewday'],
} }
if $reviewday_rsa_key_contents != '' { if $reviewday_rsa_key_contents != undef {
file { '/var/lib/reviewday/.ssh/id_rsa': file { '/var/lib/reviewday/.ssh/id_rsa':
owner => 'reviewday', owner => 'reviewday',
group => 'reviewday', group => 'reviewday',
@ -45,7 +45,7 @@ define reviewday::site(
} }
} }
if $reviewday_rsa_pubkey_contents != '' { if $reviewday_rsa_pubkey_contents != undef {
file { '/var/lib/reviewday/.ssh/id_rsa.pub': file { '/var/lib/reviewday/.ssh/id_rsa.pub':
owner => 'reviewday', owner => 'reviewday',
group => 'reviewday', group => 'reviewday',
@ -56,7 +56,7 @@ define reviewday::site(
} }
} }
if $reviewday_gerrit_ssh_key != '' { if $reviewday_gerrit_ssh_key != undef {
file { '/var/lib/reviewday/.ssh/known_hosts': file { '/var/lib/reviewday/.ssh/known_hosts':
owner => 'reviewday', owner => 'reviewday',
group => 'reviewday', group => 'reviewday',