|
1 |
| -# @summary |
| 1 | +# @summary |
2 | 2 | # Private class for managing the root password
|
3 | 3 | #
|
4 | 4 | # @api private
|
5 | 5 | #
|
6 | 6 | class mysql::server::root_password {
|
| 7 | + if $mysql::server::root_password =~ Sensitive { |
| 8 | + $root_password = $mysql::server::root_password.unwrap |
| 9 | + } else { |
| 10 | + $root_password = $mysql::server::root_password |
| 11 | + } |
| 12 | + if $root_password == 'UNSET' { |
| 13 | + $root_password_set = false |
| 14 | + } else { |
| 15 | + $root_password_set = true |
| 16 | + } |
| 17 | + |
7 | 18 | $options = $mysql::server::_options
|
8 | 19 | $secret_file = $mysql::server::install_secret_file
|
9 | 20 | $login_file = $mysql::server::login_file
|
|
23 | 34 | }
|
24 | 35 |
|
25 | 36 | # manage root password if it is set
|
26 |
| - if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' { |
| 37 | + if $mysql::server::create_root_user and $root_password_set { |
27 | 38 | mysql_user { 'root@localhost':
|
28 | 39 | ensure => present,
|
29 | 40 | password_hash => mysql::password($mysql::server::root_password),
|
30 | 41 | require => Exec['remove install pass'],
|
31 | 42 | }
|
32 | 43 | }
|
33 | 44 |
|
34 |
| - if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' { |
| 45 | + if $mysql::server::create_root_my_cnf and $root_password_set { |
| 46 | + # TODO: use EPP instead of ERB, as EPP can handle Data of Type Sensitive without further ado |
35 | 47 | file { "${::root_home}/.my.cnf":
|
36 | 48 | content => template('mysql/my.cnf.pass.erb'),
|
37 | 49 | owner => 'root',
|
|
42 | 54 | if versioncmp($::puppetversion, '3.0') >= 0 {
|
43 | 55 | File["${::root_home}/.my.cnf"] { show_diff => false }
|
44 | 56 | }
|
45 |
| - if $mysql::server::create_root_user == true { |
| 57 | + if $mysql::server::create_root_user { |
46 | 58 | Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
|
47 | 59 | }
|
48 | 60 | }
|
49 | 61 |
|
50 |
| - if $mysql::server::create_root_login_file == true and $mysql::server::root_password != 'UNSET' { |
| 62 | + if $mysql::server::create_root_login_file and $root_password_set { |
51 | 63 | file { "${::root_home}/.mylogin.cnf":
|
52 | 64 | source => $login_file,
|
53 | 65 | owner => 'root',
|
|
0 commit comments