Skip to content

Commit 2b5de59

Browse files
committed
(CONT-576) allow deferred function for token & secrets
1 parent dddc168 commit 2b5de59

File tree

9 files changed

+27
-26
lines changed

9 files changed

+27
-26
lines changed

manifests/backup/mysqlbackup.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}
4141
mysql_user { "${backupuser}@localhost":
4242
ensure => $ensure,
43-
password_hash => mysql::password($backuppassword),
43+
password_hash => Deferred('mysql::password', [$backuppassword]),
4444
require => Class['mysql::server::root_password'],
4545
}
4646

@@ -108,14 +108,14 @@
108108
'incremental_base' => 'history:last_backup',
109109
'incremental_backup_dir' => $backupdir,
110110
'user' => $backupuser,
111-
'password' => $backuppassword_unsensitive,
111+
'password' => Deferred('mysql::password', [$backuppassword_unsensitive]),
112112
},
113113
}
114114
$options = mysql::normalise_and_deepmerge($default_options, $mysql::server::override_options)
115115

116116
file { 'mysqlbackup-config-file':
117117
path => '/etc/mysql/conf.d/meb.cnf',
118-
content => template('mysql/meb.cnf.erb'),
118+
content => stdlib::deferrable_epp('mysql/meb.cnf.epp', { 'options' => $options }),
119119
mode => '0600',
120120
}
121121

manifests/backup/mysqldump.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
mysql_user { "${backupuser}@localhost":
5252
ensure => $ensure,
53-
password_hash => mysql::password($backuppassword),
53+
password_hash => Deferred('mysql::password', [$backuppassword]),
5454
require => Class['mysql::server::root_password'],
5555
}
5656

manifests/backup/xtrabackup.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if $backupuser and $backuppassword {
4747
mysql_user { "${backupuser}@localhost":
4848
ensure => $ensure,
49-
password_hash => mysql::password($backuppassword),
49+
password_hash => Deferred('mysql::password', [$backuppassword]),
5050
require => Class['mysql::server::root_password'],
5151
}
5252
# Percona XtraBackup needs additional grants/privileges to work with MySQL 8

manifests/db.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
$user_resource = {
104104
ensure => $ensure,
105-
password_hash => mysql::password($password),
105+
password_hash => Deferred('mysql::password', [$password]),
106106
tls_options => $tls_options,
107107
}
108108
ensure_resource('mysql_user', "${user}@${host}", $user_resource)

manifests/server/root_password.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
if $mysql::server::create_root_user and $root_password_set {
3333
mysql_user { 'root@localhost':
3434
ensure => present,
35-
password_hash => mysql::password($mysql::server::root_password),
35+
password_hash => Deferred('mysql::password', [$mysql::server::root_password]),
3636
require => Exec['remove install pass'],
3737
}
3838
}

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": [
1111
{
1212
"name": "puppetlabs/stdlib",
13-
"version_requirement": ">= 3.2.0 < 9.0.0"
13+
"version_requirement": ">= 8.4.0 < 9.0.0"
1414
}
1515
],
1616
"operatingsystem_support": [

spec/unit/puppet/provider/mysql_login_path/mysql_login_path_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'spec_helper'
4+
require 'puppet/resource_api/base_context'
45

56
ensure_module_defined('Puppet::Provider::MysqlLoginPath')
67
require 'puppet/provider/mysql_login_path/mysql_login_path'

templates/meb.cnf.epp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### MANAGED BY PUPPET ###
2+
3+
<% $options.map |Any $k, Any $v| { -%>
4+
<% if $v.is_a(Hash) { -%>
5+
[<%= $k %>]
6+
<% $v.map |Any $ki, Any $vi| { -%>
7+
<% if $vi == true or $v == '' {-%>
8+
<%= $ki %>
9+
<% } elsif $vi.is_a(Hash) { -%>
10+
<% $vi.each |$vii| { -%>
11+
<%= $ki %> = <%= $vii %>
12+
<% } -%>
13+
<% } elsif !($vi == '' or $vi == undef ) { -%>
14+
<%= $ki %> = <%= $vi %>
15+
<% } -%>
16+
<% } -%>
17+
<% } %>
18+
<% } -%>

templates/meb.cnf.erb

-18
This file was deleted.

0 commit comments

Comments
 (0)