Skip to content

Commit

Permalink
Merge branch 'puppetlabs:main' into mariadb_11
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-DRI authored Aug 28, 2024
2 parents faf39bf + b380c2a commit 7a25732
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 87 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/labeller.yml

This file was deleted.

107 changes: 67 additions & 40 deletions CHANGELOG.md

Large diffs are not rendered by default.

50 changes: 47 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

### Functions

* [`mysql::innobackupex_args`](#mysql--innobackupex_args): This function populates and returns the string of arguments which later gets injected in template. Arguments that return string holds is conditional and decided by the the input given to function.
* [`mysql::normalise_and_deepmerge`](#mysql--normalise_and_deepmerge): Recursively merges two or more hashes together, normalises keys with differing use of dashes and underscores.
* [`mysql::password`](#mysql--password): Hash a string as mysql's "PASSWORD()" function would do it
* [`mysql::strip_hash`](#mysql--strip_hash): When given a hash this function strips out all blank entries.
Expand Down Expand Up @@ -707,7 +708,7 @@ Data type: `Optional[String[1]]`

The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined.

Default value: `$mysql::params::server_service_provider`
Default value: `undef`

##### <a name="-mysql--server--create_root_user"></a>`create_root_user`

Expand Down Expand Up @@ -1197,15 +1198,15 @@ Data type: `String[1]`

The character set for the database. Must have the same value as collate to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs.

Default value: `'utf8'`
Default value: `'utf8mb3'`

##### <a name="-mysql--db--collate"></a>`collate`

Data type: `String[1]`

The collation for the database. Must have the same value as charset to avoid corrective changes. See https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html for charset and collation pairs.

Default value: `'utf8_general_ci'`
Default value: `'utf8mb3_general_ci'`

##### <a name="-mysql--db--host"></a>`host`

Expand Down Expand Up @@ -1606,6 +1607,49 @@ discover the appropriate provider for your platform.

## Functions

### <a name="mysql--innobackupex_args"></a>`mysql::innobackupex_args`

Type: Ruby 4.x API

This function populates and returns the string of arguments which later gets injected in template. Arguments that return string holds is conditional and decided by the the input given to function.

#### `mysql::innobackupex_args(Optional[String] $backupuser, Boolean $backupcompress, Optional[Variant[String, Sensitive[String]]] $backuppassword_unsensitive, Array[String[1]] $backupdatabases, Array[String[1]] $optional_args)`

The mysql::innobackupex_args function.

Returns: `Variant[String]` String
Generated on the basis of provided values.

##### `backupuser`

Data type: `Optional[String]`

The user to use for the backup.

##### `backupcompress`

Data type: `Boolean`

If the backup should be compressed.

##### `backuppassword_unsensitive`

Data type: `Optional[Variant[String, Sensitive[String]]]`

The password to use for the backup.

##### `backupdatabases`

Data type: `Array[String[1]]`

The databases to backup.

##### `optional_args`

Data type: `Array[String[1]]`

Additional arguments to pass to innobackupex.

### <a name="mysql--normalise_and_deepmerge"></a>`mysql::normalise_and_deepmerge`

Type: Ruby 4.x API
Expand Down
22 changes: 13 additions & 9 deletions lib/puppet/functions/mysql/innobackupex_args.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# frozen_string_literal: true

# @summary this function populates and returns the string of arguments which later gets injected in template.
# arguments that return string holds is conditional and decided by the the input given to function.

# @summary
# This function populates and returns the string of arguments which later gets injected in template. Arguments that return string holds is conditional and decided by the the input given to function.
#
Puppet::Functions.create_function(:'mysql::innobackupex_args') do
# @param args
# String backupuser
# Boolean backupcompress
# String backuppassword_unsensitive
# Array backupdatabases
# Array optional_args
# @param backupuser
# The user to use for the backup.
# @param backupcompress
# If the backup should be compressed.
# @param backuppassword_unsensitive
# The password to use for the backup.
# @param backupdatabases
# The databases to backup.
# @param optional_args
# Additional arguments to pass to innobackupex.
#
# @return String
# Generated on the basis of provided values.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/functions/mysql/password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def password(password, sensitive = false)
password = password.unwrap if password.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)

result_string = if %r{\*[A-F0-9]{40}$}.match?(password)
result_string = if %r{^\*[A-F0-9]{40}$}.match?(password)
password
elsif password.empty?
''
Expand Down
4 changes: 2 additions & 2 deletions manifests/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
Variant[String, Sensitive[String]] $password,
Optional[Array[String[1]]] $tls_options = undef,
String $dbname = $name,
String[1] $charset = 'utf8',
String[1] $collate = 'utf8_general_ci',
String[1] $charset = 'utf8mb3',
String[1] $collate = 'utf8mb3_general_ci',
String[1] $host = 'localhost',
Variant[String[1], Array[String[1]]] $grant = 'ALL',
Optional[Variant[String[1], Array[String[1]]]] $grant_options = undef,
Expand Down
1 change: 0 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@
'basedir' => $mysql::params::basedir,
'bind-address' => '127.0.0.1',
'datadir' => $mysql::params::datadir,
'expire_logs_days' => '10',
'key_buffer_size' => '16M',
'log-error' => $mysql::params::log_error,
'max_allowed_packet' => '16M',
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-mysql",
"version": "15.0.0",
"version": "16.0.0",
"author": "puppetlabs",
"summary": "Installs, configures, and manages the MySQL service.",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/00_mysql_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class { '::mysql::server':
end

it 'can be set' do
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).to be_empty
end
# TODO : Returning warning message while running above manifest
# Warning: Facter: Container runtime, 'docker', is unsupported, setting to, 'container_other'
apply_manifest(pp)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/functions/mysql_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
expect(subject).to run.with_params('').and_return('')
end

it 'converts the password when its given in caps with * sign' do
expect(subject).to run.with_params('AFDJKFD1*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29').and_return('*91FF6DD4E1FC57D2EFC57F49552D0596F7D46BAF')
end

it 'does not convert a password that is already a hash' do
expect(subject).to run.with_params('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19').and_return('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19')
end
Expand Down

0 comments on commit 7a25732

Please sign in to comment.