Skip to content

Commit 67c7375

Browse files
author
carabasdaniel
committed
Merge branch 'master' into allow-adapt-config-file-permissions
2 parents 36f75fc + 775bed0 commit 67c7375

File tree

17 files changed

+128
-68
lines changed

17 files changed

+128
-68
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77

88
jobs:
99
LitmusAcceptance:
10-
10+
env:
11+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
12+
HONEYCOMB_DATASET: litmus tests
1113
runs-on: self-hosted
1214

1315
strategy:

.sync.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
- rubocop-i18n
99
- rubocop-rspec
1010
".travis.yml":
11+
global_env:
12+
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"
1113
deploy_to_forge:
1214
enabled: false
1315
branches:
@@ -67,10 +69,10 @@
6769
stage: acceptance
6870
- bundler_args:
6971
dist: trusty
70-
env: PLATFORMS=el7_puppet5
72+
env: PLATFORMS=el6_puppet5
7173
rvm: 2.5.3
7274
before_script:
73-
- bundle exec rake 'litmus:provision_list[travis_el7]'
75+
- bundle exec rake 'litmus:provision_list[travis_el6]'
7476
- bundle exec rake 'litmus:install_agent[puppet5]'
7577
- bundle exec rake litmus:install_module
7678
script:
@@ -80,10 +82,10 @@
8082
stage: acceptance
8183
- bundler_args:
8284
dist: trusty
83-
env: PLATFORM=el7_puppet6
85+
env: PLATFORM=el6_puppet6
8486
rvm: 2.5.3
8587
before_script:
86-
- bundle exec rake 'litmus:provision_list[travis_el7]'
88+
- bundle exec rake 'litmus:provision_list[travis_el6]'
8789
- bundle exec rake 'litmus:install_agent[puppet6]'
8890
- bundle exec rake litmus:install_module
8991
script:
@@ -93,10 +95,10 @@
9395
stage: acceptance
9496
- bundler_args:
9597
dist: trusty
96-
env: PLATFORMS=el6_puppet5
98+
env: PLATFORMS=el7_puppet5
9799
rvm: 2.5.3
98100
before_script:
99-
- bundle exec rake 'litmus:provision_list[travis_el6]'
101+
- bundle exec rake 'litmus:provision_list[travis_el7]'
100102
- bundle exec rake 'litmus:install_agent[puppet5]'
101103
- bundle exec rake litmus:install_module
102104
script:
@@ -106,10 +108,10 @@
106108
stage: acceptance
107109
- bundler_args:
108110
dist: trusty
109-
env: PLATFORMS=el6_puppet6
111+
env: PLATFORMS=el7_puppet6
110112
rvm: 2.5.3
111113
before_script:
112-
- bundle exec rake 'litmus:provision_list[travis_el6]'
114+
- bundle exec rake 'litmus:provision_list[travis_el7]'
113115
- bundle exec rake 'litmus:install_agent[puppet6]'
114116
- bundle exec rake litmus:install_module
115117
script:

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ before_install:
77
- rm -f Gemfile.lock
88
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
99
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
10-
- '[ -z "$RUBYGEMS_VERSION" ] || gem update --system $RUBYGEMS_VERSION'
10+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
11+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
1112
- gem --version
1213
- bundle -v
1314
script:
1415
- 'SIMPLECOV=yes bundle exec rake $CHECK'
1516
bundler_args: --without system_tests
1617
rvm:
1718
- 2.5.3
19+
env:
20+
global:
21+
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"
1822
stages:
1923
- static
2024
- spec
@@ -107,7 +111,7 @@ matrix:
107111
before_script: ["bundle exec rake 'litmus:provision_list[travis_el7]'", "bundle exec rake 'litmus:install_agent[puppet6]'", "bundle exec rake litmus:install_module"]
108112
bundler_args:
109113
dist: trusty
110-
env: PLATFORM=el7_puppet6
114+
env: PLATFORMS=el7_puppet6
111115
rvm: 2.5.3
112116
script: ["bundle exec rake litmus:acceptance:parallel"]
113117
services: docker

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ group :development do
2424
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2525
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2626
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27-
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
28-
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
29-
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30-
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27+
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
28+
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
29+
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30+
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3131
gem "puppet-lint-i18n", require: false
3232
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
3333
end

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ replicate-do-db = base2
9595

9696
To implement version specific parameters, specify the version, such as [mysqld-5.5]. This allows one config for different versions of MySQL.
9797

98+
If you don’t want to use the default configuration, you can also supply your options to the `$options` parameter instead of `$override_options`.
99+
Please note that `$options` and `$override_options` are mutually exclusive, you can only use one of them.
100+
98101
### Create a database
99102

100103
To create a database with a user and some assigned privileges:
@@ -250,19 +253,19 @@ Class['mysql::bindings']
250253

251254
#### Optional: Install the MariaDB official repo
252255

253-
In this example, we'll use the latest stable (currently 10.1) from the official MariaDB repository, not the one from the distro repository. You could instead use the package from the Ubuntu repository. Make sure you use the repository corresponding to the version you want.
256+
In this example, we'll use the latest stable (currently 10.3) from the official MariaDB repository, not the one from the distro repository. You could instead use the package from the Ubuntu repository. Make sure you use the repository corresponding to the version you want.
254257

255258
**Note:** `sfo1.mirrors.digitalocean.com` is one of many mirrors available. You can use any official mirror.
256259

257260
```puppet
258261
include apt
259262
260263
apt::source { 'mariadb':
261-
location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu',
264+
location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu',
262265
release => $::lsbdistcodename,
263266
repos => 'main',
264267
key => {
265-
id => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
268+
id => '177F4010FE56CA3336300305F1656F24C74CD1D8',
266269
server => 'hkp://keyserver.ubuntu.com:80',
267270
},
268271
include => {
@@ -274,7 +277,7 @@ apt::source { 'mariadb':
274277

275278
#### Install the MariaDB server
276279

277-
This example shows MariaDB server installation on Ubuntu Trusty. Adjust the version and the parameters of `my.cnf` as needed. All parameters of the `my.cnf` can be defined using the `override_options` parameter.
280+
This example shows MariaDB server installation on Ubuntu Xenial. Adjust the version and the parameters of `my.cnf` as needed. All parameters of the `my.cnf` can be defined using the `override_options` parameter.
278281

279282
The folders `/var/log/mysql` and `/var/run/mysqld` are created automatically, but if you are using other custom folders, they should exist as prerequisites for this code.
280283

@@ -285,8 +288,8 @@ Specify the version of the package you want with the `package_ensure` parameter.
285288
```puppet
286289
class {'::mysql::server':
287290
package_name => 'mariadb-server',
288-
package_ensure => '10.1.14+maria-1~trusty',
289-
service_name => 'mysql',
291+
package_ensure => '1:10.3.21+maria~xenial',
292+
service_name => 'mysqld',
290293
root_password => 'AVeryStrongPasswordUShouldEncrypt!',
291294
override_options => {
292295
mysqld => {
@@ -316,7 +319,7 @@ Specify the version of the package you want with the `package_ensure` parameter.
316319
```puppet
317320
class {'::mysql::client':
318321
package_name => 'mariadb-client',
319-
package_ensure => '10.1.14+maria-1~trusty',
322+
package_ensure => '1:10.3.21+maria~xenial',
320323
bindings_enable => true,
321324
}
322325

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
24
require 'puppetlabs_spec_helper/rake_tasks'
35
require 'puppet-syntax/tasks/puppet-syntax'

locales/puppetlabs-mysql.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ msgid ""
7777
"future release."
7878
msgstr ""
7979

80+
#. ./manifests/server.pp:122
81+
msgid ""
82+
"You can\'t specify $options and $override_options simultaneously, see the "
83+
"README section \'Customize server options\'!"
84+
msgstr ""
85+
8086
#: ./lib/puppet/parser/functions/mysql_deepmerge.rb:22
8187
msgid ""
8288
"mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at "

manifests/server.pp

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# Path to secret file containing temporary root password.
2222
# @param manage_config_file
2323
# Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`.
24+
# @param options
25+
# A hash of options structured like the override_options, but not merged with the default options. Use this if you don’t want your options merged with the default options.
2426
# @param override_options
2527
# Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details.
2628
# @param package_ensure
@@ -67,38 +69,38 @@
6769
# This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password.
6870
#
6971
class mysql::server (
70-
$config_file = $mysql::params::config_file,
71-
$config_file_mode = $mysql::params::config_file_mode,
72-
$includedir = $mysql::params::includedir,
73-
$install_options = undef,
74-
$install_secret_file = $mysql::params::install_secret_file,
75-
$manage_config_file = $mysql::params::manage_config_file,
76-
$override_options = {},
77-
$package_ensure = $mysql::params::server_package_ensure,
78-
$package_manage = $mysql::params::server_package_manage,
79-
$package_name = $mysql::params::server_package_name,
80-
$purge_conf_dir = $mysql::params::purge_conf_dir,
81-
$remove_default_accounts = false,
82-
$restart = $mysql::params::restart,
83-
$root_group = $mysql::params::root_group,
84-
$mysql_group = $mysql::params::mysql_group,
85-
$root_password = $mysql::params::root_password,
86-
$service_enabled = $mysql::params::server_service_enabled,
87-
$service_manage = $mysql::params::server_service_manage,
88-
$service_name = $mysql::params::server_service_name,
89-
$service_provider = $mysql::params::server_service_provider,
90-
$create_root_user = $mysql::params::create_root_user,
91-
$create_root_my_cnf = $mysql::params::create_root_my_cnf,
92-
$create_root_login_file = $mysql::params::create_root_login_file,
93-
$login_file = $mysql::params::login_file,
94-
$users = {},
95-
$grants = {},
96-
$databases = {},
97-
98-
# Deprecated parameters
99-
$enabled = undef,
100-
$manage_service = undef,
101-
$old_root_password = undef
72+
$config_file = $mysql::params::config_file,
73+
$config_file_mode = $mysql::params::config_file_mode,
74+
$includedir = $mysql::params::includedir,
75+
$install_options = undef,
76+
$install_secret_file = $mysql::params::install_secret_file,
77+
$manage_config_file = $mysql::params::manage_config_file,
78+
Mysql::Options $options = {},
79+
$override_options = {},
80+
$package_ensure = $mysql::params::server_package_ensure,
81+
$package_manage = $mysql::params::server_package_manage,
82+
$package_name = $mysql::params::server_package_name,
83+
$purge_conf_dir = $mysql::params::purge_conf_dir,
84+
$remove_default_accounts = false,
85+
$restart = $mysql::params::restart,
86+
$root_group = $mysql::params::root_group,
87+
$mysql_group = $mysql::params::mysql_group,
88+
$root_password = $mysql::params::root_password,
89+
$service_enabled = $mysql::params::server_service_enabled,
90+
$service_manage = $mysql::params::server_service_manage,
91+
$service_name = $mysql::params::server_service_name,
92+
$service_provider = $mysql::params::server_service_provider,
93+
$create_root_user = $mysql::params::create_root_user,
94+
$create_root_my_cnf = $mysql::params::create_root_my_cnf,
95+
$create_root_login_file = $mysql::params::create_root_login_file,
96+
$login_file = $mysql::params::login_file,
97+
$users = {},
98+
$grants = {},
99+
$databases = {},
100+
# Deprecated parameters
101+
$enabled = undef,
102+
$manage_service = undef,
103+
$old_root_password = undef
102104
) inherits mysql::params {
103105

104106
# Deprecated parameters.
@@ -118,8 +120,16 @@
118120
warning(translate('The `old_root_password` attribute is no longer used and will be removed in a future release.'))
119121
}
120122

121-
# Create a merged together set of options. Rightmost hashes win over left.
122-
$options = mysql::normalise_and_deepmerge($mysql::params::default_options, $override_options)
123+
if ! empty($options) and ! empty($override_options) {
124+
fail(translate('You can\'t specify $options and $override_options simultaneously, see the README section \'Customize server options\'!'))
125+
}
126+
127+
# If override_options are set, create a merged together set of options. Rightmost hashes win over left.
128+
# If options are set, just use them.
129+
$_options = empty($options) ? {
130+
true => mysql::normalise_and_deepmerge($mysql::params::default_options, $override_options),
131+
false => $options,
132+
}
123133

124134
Class['mysql::server::root_password'] -> Mysql::Db <| |>
125135

manifests/server/binarylog.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
class mysql::server::binarylog {
77

8-
$options = $mysql::server::options
8+
$options = $mysql::server::_options
99
$includedir = $mysql::server::includedir
1010

1111
$logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false)

manifests/server/config.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
class mysql::server::config {
77

8-
$options = $mysql::server::options
8+
$options = $mysql::server::_options
99
$includedir = $mysql::server::includedir
1010

1111
File {

0 commit comments

Comments
 (0)