From 93175f7b82878d7038b1ca7c4cc21248f301115a Mon Sep 17 00:00:00 2001 From: Mason Malone Date: Mon, 24 Nov 2014 17:16:42 -0500 Subject: [PATCH] Parameterize the jira::dburl variable This is so $dburl can be overriden as a workaround for the following bug in Mysql Connector/J 5.1.16: https://confluence.atlassian.com/display/JIRAKB/%27NullPointerException+at+com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding%27+Error+When+Using+MySQL+Driver+v5.1.16 --- manifests/init.pp | 11 ++++++++++- templates/dbconfig.mysql.xml.erb | 4 ++-- templates/dbconfig.postgresql.xml.erb | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3574c6f2..f2ecbb1c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,6 +52,7 @@ $dbport = '5432', $dbdriver = 'org.postgresql.Driver', $dbtype = 'postgres72', + $dburl = undef, $poolsize = '20', $mysql_connector_package = $jira::params::mysql_connector_package, $mysql_connector_jar = $jira::params::mysql_connector_jar, @@ -118,7 +119,15 @@ } $webappdir = "${installdir}/atlassian-${product}-${version}-standalone" - $dburl = "jdbc:${db}://${dbserver}:${dbport}/${dbname}" + if $dburl { + $dburl_real = $dburl + } + else { + $dburl_real = $db ? { + 'postgresql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}", + 'mysql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB", + } + } anchor { 'jira::start': } -> diff --git a/templates/dbconfig.mysql.xml.erb b/templates/dbconfig.mysql.xml.erb index e61bdfcf..d4cdbebb 100644 --- a/templates/dbconfig.mysql.xml.erb +++ b/templates/dbconfig.mysql.xml.erb @@ -5,7 +5,7 @@ default mysql - <%= scope.lookupvar('jira::dburl') %>?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB + <%= scope.lookupvar('jira::dburl_real') %> <%= scope.lookupvar('jira::dbdriver') %> <%= scope.lookupvar('jira::dbuser') %> <%= scope.lookupvar('jira::dbpassword') %> @@ -22,4 +22,4 @@ <%= scope.lookupvar('jira::poolTestWhileIdle') %> 3 - \ No newline at end of file + diff --git a/templates/dbconfig.postgresql.xml.erb b/templates/dbconfig.postgresql.xml.erb index c5ee506e..0964a875 100644 --- a/templates/dbconfig.postgresql.xml.erb +++ b/templates/dbconfig.postgresql.xml.erb @@ -6,7 +6,7 @@ <%= scope.lookupvar('jira::dbtype') %> public - <%= scope.lookupvar('jira::dburl') %> + <%= scope.lookupvar('jira::dburl_real') %> <%= scope.lookupvar('jira::dbdriver') %> <%= scope.lookupvar('jira::dbuser') %> <%= scope.lookupvar('jira::dbpassword') %>