@@ -266,7 +266,46 @@ class { 'mysql::server':
266
266
end
267
267
end
268
268
269
+ # On Ubuntu 20.04 'ALL' now returns as the sum of it's constitute parts and so require a specific test
270
+ describe 'ALL privilege on newer MySQL versions' , if : os [ :family ] == 'ubuntu' && os [ :release ] =~ %r{^20\. 04} do
271
+ pp_one = <<-MANIFEST
272
+ mysql_user { 'all@localhost':
273
+ ensure => present,
274
+ }
275
+ mysql_grant { 'all@localhost/*.*':
276
+ user => 'all@localhost',
277
+ privileges => ['ALL'],
278
+ table => '*.*',
279
+ require => Mysql_user['all@localhost'],
280
+ }
281
+ MANIFEST
282
+ it "create ['ALL'] privs" do
283
+ apply_manifest ( pp_one , catch_failures : true )
284
+ end
285
+
286
+ pp_two = <<-MANIFEST
287
+ mysql_user { 'all@localhost':
288
+ ensure => present,
289
+ }
290
+ mysql_grant { 'all@localhost/*.*':
291
+ user => 'all@localhost',
292
+ privileges => ['ALTER', 'ALTER ROUTINE', 'CREATE', 'CREATE ROLE', 'CREATE ROUTINE', 'CREATE TABLESPACE', 'CREATE TEMPORARY TABLES', 'CREATE USER', 'CREATE VIEW', 'DELETE', 'DROP', 'DROP ROLE', 'EVENT', 'EXECUTE', 'FILE', 'INDEX', 'INSERT', 'LOCK TABLES', 'PROCESS', 'REFERENCES', 'RELOAD', 'REPLICATION CLIENT', 'REPLICATION SLAVE', 'SELECT', 'SHOW DATABASES', 'SHOW VIEW', 'SHUTDOWN', 'SUPER', 'TRIGGER', 'UPDATE'],
293
+ table => '*.*',
294
+ require => Mysql_user['all@localhost'],
295
+ }
296
+ MANIFEST
297
+ it "create ['ALL'] constitute parts privs" do
298
+ apply_manifest ( pp_two , catch_changes : true )
299
+ end
300
+ end
301
+
269
302
describe 'complex test' do
303
+ # On Ubuntu 20.04 'ALL' now returns as the sum of it's constitute parts and so is no longer idempotent when set
304
+ privileges = if os [ :family ] == 'ubuntu' && os [ :release ] =~ %r{^20\. 04}
305
+ "['SELECT', 'INSERT', 'UPDATE']"
306
+ else
307
+ "['ALL']"
308
+ end
270
309
pp = <<-MANIFEST
271
310
$dbSubnet = '10.10.10.%'
272
311
@@ -284,7 +323,7 @@ class { 'mysql::server':
284
323
Mysql_grant {
285
324
ensure => present,
286
325
options => ['GRANT'],
287
- privileges => ['ALL'] ,
326
+ privileges => #{ privileges } ,
288
327
table => '*.*',
289
328
require => [ Mysql_database['foo'], Exec['mysql-create-table'] ],
290
329
}
@@ -355,12 +394,12 @@ class { 'mysql::server':
355
394
}
356
395
mysql_grant { 'lowercase@localhost/*.*':
357
396
user => 'lowercase@localhost',
358
- privileges => 'ALL' ,
397
+ privileges => ['SELECT', 'INSERT', 'UPDATE'] ,
359
398
table => '*.*',
360
399
require => Mysql_user['lowercase@localhost'],
361
400
}
362
401
MANIFEST
363
- it ' create ALL privs' do
402
+ it " create ['SELECT', 'INSERT', 'UPDATE'] privs" do
364
403
apply_manifest ( pp_one , catch_failures : true )
365
404
end
366
405
@@ -370,12 +409,12 @@ class { 'mysql::server':
370
409
}
371
410
mysql_grant { 'lowercase@localhost/*.*':
372
411
user => 'lowercase@localhost',
373
- privileges => 'all' ,
412
+ privileges => ['select', 'insert', 'update'] ,
374
413
table => '*.*',
375
414
require => Mysql_user['lowercase@localhost'],
376
415
}
377
416
MANIFEST
378
- it ' create lowercase all privs' do
417
+ it " create lowercase ['select', 'insert', 'update'] privs" do
379
418
apply_manifest ( pp_two , catch_changes : true )
380
419
end
381
420
end
0 commit comments