Skip to content

Commit 23b01fd

Browse files
committed
add new specific variable for onlif commands
1 parent 1464bd1 commit 23b01fd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

manifests/server/grant.pp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,14 @@
425425
# }
426426
case $_object_name {
427427
Array: {
428-
# pg_* views does not contain schema name as part of the object name
429-
$_togrant_object = $_object_name
428+
$_togrant_object = $_enquote_object ? {
429+
false => join($_object_name, '.'),
430+
default => join($_object_name, '"."'),
431+
}
430432
# Never put double quotes into has_*_privilege function
431433
$_granted_object = join($_object_name, '.')
434+
# pg_* views does not contain schema name as part of the object name
435+
$_togrant_object_only = $_object_name[1]
432436
}
433437
default: {
434438
$_granted_object = $_object_name
@@ -449,10 +453,10 @@
449453
}
450454

451455
$_onlyif = $onlyif_function ? {
452-
'table_exists' => "SELECT true FROM pg_tables WHERE tablename = '${_togrant_object}'",
453-
'language_exists' => "SELECT true from pg_language WHERE lanname = '${_togrant_object}'",
456+
'table_exists' => "SELECT true FROM pg_tables WHERE tablename = '${_togrant_object_only}'",
457+
'language_exists' => "SELECT true from pg_language WHERE lanname = '${_togrant_object_only}}'",
454458
'role_exists' => "SELECT 1 FROM pg_roles WHERE rolname = '${role}' or '${role}' = 'PUBLIC'",
455-
'function_exists' => "SELECT true FROM pg_proc WHERE (oid::regprocedure)::text = '${_togrant_object}${arguments}'",
459+
'function_exists' => "SELECT true FROM pg_proc WHERE (oid::regprocedure)::text = '${_togrant_object_only}}${arguments}'",
456460
default => undef,
457461
}
458462

0 commit comments

Comments
 (0)