File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1011,6 +1011,12 @@ The user for the database you're creating.
1011
1011
1012
1012
The password for $user for the database you're creating.
1013
1013
1014
+ ##### ` tls_options `
1015
+
1016
+ The tls_options for $user for the database you're creating.
1017
+
1018
+ Defaults to ` undef ` .
1019
+
1014
1020
##### ` dbname `
1015
1021
1016
1022
The name of the database to create.
@@ -1041,6 +1047,12 @@ The privileges to be granted for user@host on the database.
1041
1047
1042
1048
Defaults to 'ALL'.
1043
1049
1050
+ ##### ` grant_options `
1051
+
1052
+ The grant_options for the grant for user@host on the database.
1053
+
1054
+ Defaults to ` undef ` .
1055
+
1044
1056
##### ` sql `
1045
1057
1046
1058
The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings.
Original file line number Diff line number Diff line change 2
2
define mysql::db (
3
3
$user ,
4
4
$password ,
5
+ $tls_options = undef ,
5
6
$dbname = $name,
6
7
$charset = ' utf8' ,
7
8
$collate = ' utf8_general_ci' ,
8
9
$host = ' localhost' ,
9
10
$grant = ' ALL' ,
11
+ $grant_options = undef ,
10
12
Optional[Variant[Array, Hash, String]] $sql = undef ,
11
13
$enforce_sql = false ,
12
14
Enum['absent', 'present'] $ensure = ' present' ,
13
15
$import_timeout = 300,
14
16
$import_cat_cmd = ' cat' ,
15
17
) {
16
- # input validation
18
+
17
19
$table = " ${dbname} .*"
18
20
19
21
$sql_inputs = join([$sql ], ' ' )
32
34
$user_resource = {
33
35
ensure => $ensure ,
34
36
password_hash => mysql_password($password ),
37
+ tls_options => $tls_options ,
35
38
}
36
39
ensure_resource(' mysql_user' , " ${user} @${host} " , $user_resource )
37
40
41
44
provider => ' mysql' ,
42
45
user => " ${user} @${host} " ,
43
46
table => $table ,
47
+ options => $grant_options ,
44
48
require => [
45
49
Mysql_database[$dbname ],
46
50
Mysql_user[" ${user} @${host} " ],
Original file line number Diff line number Diff line change 70
70
params [ 'dbname' ] = 'real_db'
71
71
is_expected . to contain_mysql_database ( 'real_db' )
72
72
end
73
+
74
+ it 'uses tls_options for user when set' do
75
+ params [ 'tls_options' ] = [ 'SSL' ]
76
+ is_expected . to contain_mysql_user ( 'testuser@localhost' ) . with_tls_options ( [ 'SSL' ] )
77
+ end
78
+
79
+ it 'uses grant_options for grant when set' do
80
+ params [ 'grant_options' ] = [ 'GRANT' ]
81
+ is_expected . to contain_mysql_grant ( 'testuser@localhost/test_db.*' ) . with_grant_options ( [ 'GRANT' ] )
82
+ end
73
83
end
74
84
end
75
85
end
You can’t perform that action at this time.
0 commit comments