Skip to content

Commit

Permalink
(CONT-576) allow deferred function for token & secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramesh7 committed May 22, 2023
1 parent 0912ae2 commit 62930bd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 8 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions manifests/backup/mysqlbackup.pp
Expand Up @@ -40,7 +40,7 @@
}
mysql_user { "${backupuser}@localhost":
ensure => $ensure,
password_hash => mysql::password($backuppassword),
password_hash => Deferred('mysql::password', [$backuppassword]),
require => Class['mysql::server::root_password'],
}

Expand Down Expand Up @@ -108,14 +108,14 @@
'incremental_base' => 'history:last_backup',
'incremental_backup_dir' => $backupdir,
'user' => $backupuser,
'password' => $backuppassword_unsensitive,
'password' => Deferred('mysql::password', [$backuppassword_unsensitive]),
},
}
$options = mysql::normalise_and_deepmerge($default_options, $mysql::server::override_options)

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

Expand Down
2 changes: 1 addition & 1 deletion manifests/backup/mysqldump.pp
Expand Up @@ -50,7 +50,7 @@

mysql_user { "${backupuser}@localhost":
ensure => $ensure,
password_hash => mysql::password($backuppassword),
password_hash => Deferred('mysql::password', [$backuppassword]),
require => Class['mysql::server::root_password'],
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/backup/xtrabackup.pp
Expand Up @@ -46,7 +46,7 @@
if $backupuser and $backuppassword {
mysql_user { "${backupuser}@localhost":
ensure => $ensure,
password_hash => mysql::password($backuppassword),
password_hash => Deferred('mysql::password', [$backuppassword]),
require => Class['mysql::server::root_password'],
}
# Percona XtraBackup needs additional grants/privileges to work with MySQL 8
Expand Down
2 changes: 1 addition & 1 deletion manifests/db.pp
Expand Up @@ -102,7 +102,7 @@

$user_resource = {
ensure => $ensure,
password_hash => mysql::password($password),
password_hash => Deferred('mysql::password', [$password]),
tls_options => $tls_options,
}
ensure_resource('mysql_user', "${user}@${host}", $user_resource)
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/root_password.pp
Expand Up @@ -32,7 +32,7 @@
if $mysql::server::create_root_user and $root_password_set {
mysql_user { 'root@localhost':
ensure => present,
password_hash => mysql::password($mysql::server::root_password),
password_hash => Deferred('mysql::password', [$mysql::server::root_password]),
require => Exec['remove install pass'],
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Expand Up @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 3.2.0 < 9.0.0"
"version_requirement": ">= 8.4.0 < 9.0.0"
}
],
"operatingsystem_support": [
Expand Down
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper'
require 'puppet/resource_api/base_context'

ensure_module_defined('Puppet::Provider::MysqlLoginPath')
require 'puppet/provider/mysql_login_path/mysql_login_path'
Expand Down
18 changes: 18 additions & 0 deletions templates/meb.cnf.epp
@@ -0,0 +1,18 @@
### MANAGED BY PUPPET ###

<% $options.map |Any $k, Any $v| { -%>
<% if $v.is_a(Hash) { -%>
[<%= $k %>]
<% $v.map |Any $ki, Any $vi| { -%>
<% if $vi == true or $v == '' {-%>
<%= $ki %>
<% } elsif $vi.is_a(Hash) { -%>
<% $vi.each |$vii| { -%>
<%= $ki %> = <%= $vii %>
<% } -%>
<% } elsif !($vi == '' or $vi == undef ) { -%>
<%= $ki %> = <%= $vi %>
<% } -%>
<% } -%>
<% } %>
<% } -%>

0 comments on commit 62930bd

Please sign in to comment.