From e795312612adace7423d8ad6dcd30e5cab5f6bbe Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Thu, 25 Nov 2021 12:44:26 +0200 Subject: [PATCH] Add Debian support --- metadata.json | 6 ++++++ spec/acceptance/mysql_spec.rb | 30 ++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 5d247ce1..38ac590f 100644 --- a/metadata.json +++ b/metadata.json @@ -59,6 +59,12 @@ "7" ] }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "11" + ] + }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ diff --git a/spec/acceptance/mysql_spec.rb b/spec/acceptance/mysql_spec.rb index 9c18e857..dc2b6a95 100644 --- a/spec/acceptance/mysql_spec.rb +++ b/spec/acceptance/mysql_spec.rb @@ -5,11 +5,12 @@ describe 'jira mysql' do it 'installs with defaults' do pp = <<-EOS - # On ubuntu 20.04 and 22.04 the default is to install mariadb + # On Debian 11 and Ubuntu 20.04 and 22.04 the default is to install mariadb # As the ubuntu 20.04 runner we use in github actions allready has mysql installed # a apparmor error is triggerd when using mariadb in this test.. # Forcing the use of mysql - if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '20.04') >= 0 { + if ( $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '20.04') >= 0 ) + or ( $facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') >= 0 ) { $mysql_service_name = 'mysql' $mysql_server_package = 'mysql-server' $mysql_client_package = 'mysql-client' @@ -19,10 +20,35 @@ $mysql_client_package = undef } + # Debian docker image doesn't include any repo with mysql + if $facts['os']['name'] == 'Debian' { + file { '/tmp/mysql-apt-config.deb': + source => 'http://repo.mysql.com/mysql-apt-config.deb', + } + ~> exec { 'mysql apt repository': + command => '/usr/bin/dpkg -i /tmp/mysql-apt-config.deb', + refreshonly => true, + } + ~> exec { 'apt-update': + command => '/usr/bin/apt-get update', + refreshonly => true, + } + } + + # The puppetlabs-mysql module does not manage the config file correctly on Debian + # Fails idempotency test because the module manages the config file before installing + # package mysql_server and package mysql_server overwrites this. + if $facts['os']['name'] == 'Debian' { + $manage_config_file = false + } else { + $manage_config_file = undef + } + class { 'mysql::server': root_password => 'strongpassword', package_name => $mysql_server_package, service_name => $mysql_service_name, + manage_config_file => $manage_config_file, } class { 'mysql::client': package_name => $mysql_client_package,