Skip to content

(CONT-576) allow deferred function for token & secrets #1569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manifests/backup/mysqlbackup.pp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observed failure on my local with uninitialized

  2) Puppet::Provider::MysqlLoginPath::MysqlLoginPath create(context, name, should) creates the resource
     Failure/Error: let(:context) { instance_double(Puppet::ResourceApi::BaseContext) }

     NameError:
       uninitialized constant Puppet::ResourceApi::BaseContext

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
Original file line number Diff line number Diff line change
@@ -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 %>
<% } -%>
<% } -%>
<% } %>
<% } -%>
18 changes: 0 additions & 18 deletions templates/meb.cnf.erb

This file was deleted.