From 4e86b746c329dbbcb5ef2408e4004ab39ffeb11c Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 2 Dec 2016 15:24:14 -0800 Subject: [PATCH] Set the mysql driver name based on ubuntu package The different versions of ubuntu packaging use different driver names for the mysql jdbc connector. Ensure we use the correct one on trusty and on xenial. Change-Id: I2cb154925bd67decd21fd440c13d3aafc4d8d982 --- manifests/init.pp | 9 +++++++++ templates/standalone.xml.erb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 82d02f8..261d128 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -104,6 +104,15 @@ class zanata( require => Package['unzip'], } + # The mysql driver name differs based on the version of the package. Ensure + # we set it correctly when writing the standalone.xml config file below. + if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') { + $mysql_driver_name = 'mysql-connector-java.jar_com.mysql.jdbc.Driver_5_1' + } + else { + $mysql_driver_name = 'mysql-connector-java.jar' + } + file { '/opt/wildfly/standalone/deployments/mysql-connector-java.jar': ensure => 'link', target => '/usr/share/java/mysql-connector-java.jar', diff --git a/templates/standalone.xml.erb b/templates/standalone.xml.erb index 7d86fee..53993d0 100644 --- a/templates/standalone.xml.erb +++ b/templates/standalone.xml.erb @@ -155,7 +155,7 @@ jdbc:mysql://<%= @mysql_host %>:<%= @mysql_port %>/zanata?characterEncoding=UTF-8 com.mysql.jdbc.Driver - mysql-connector-java.jar + <%= @mysql_driver_name %> 0 20