File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 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.
10111011
10121012The password for $user for the database you're creating.
10131013
1014+ ##### ` tls_options `
1015+
1016+ The tls_options for $user for the database you're creating.
1017+
1018+ Defaults to ` undef ` .
1019+
10141020##### ` dbname `
10151021
10161022The name of the database to create.
@@ -1041,6 +1047,12 @@ The privileges to be granted for user@host on the database.
10411047
10421048Defaults to 'ALL'.
10431049
1050+ ##### ` grant_options `
1051+
1052+ The grant_options for the grant for user@host on the database.
1053+
1054+ Defaults to ` undef ` .
1055+
10441056##### ` sql `
10451057
10461058The 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 22define mysql::db (
33 $user ,
44 $password ,
5+ $tls_options = undef ,
56 $dbname = $name,
67 $charset = ' utf8' ,
78 $collate = ' utf8_general_ci' ,
89 $host = ' localhost' ,
910 $grant = ' ALL' ,
11+ $grant_options = undef ,
1012 Optional[Variant[Array, Hash, String]] $sql = undef ,
1113 $enforce_sql = false ,
1214 Enum['absent', 'present'] $ensure = ' present' ,
1315 $import_timeout = 300,
1416 $import_cat_cmd = ' cat' ,
1517) {
16- # input validation
18+
1719 $table = " ${dbname} .*"
1820
1921 $sql_inputs = join([$sql ], ' ' )
3234 $user_resource = {
3335 ensure => $ensure ,
3436 password_hash => mysql_password($password ),
37+ tls_options => $tls_options ,
3538 }
3639 ensure_resource(' mysql_user' , " ${user} @${host} " , $user_resource )
3740
4144 provider => ' mysql' ,
4245 user => " ${user} @${host} " ,
4346 table => $table ,
47+ options => $grant_options ,
4448 require => [
4549 Mysql_database[$dbname ],
4650 Mysql_user[" ${user} @${host} " ],
Original file line number Diff line number Diff line change 7070 params [ 'dbname' ] = 'real_db'
7171 is_expected . to contain_mysql_database ( 'real_db' )
7272 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
7383 end
7484 end
7585end
You can’t perform that action at this time.
0 commit comments