Skip to content

Commit 0c687b7

Browse files
author
Travis Fields
committed
(maint) Ensure strict variable support
1 parent d07bce5 commit 0c687b7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

manifests/login/permissions.pp

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040
validate_re($_state,'^(GRANT|REVOKE|DENY)$', "State parameter can only be one of 'GRANT', 'REVOKE' or 'DENY', you passed a value of ${state}")
4141

4242
validate_bool($with_grant_option)
43-
if $with_grant_option {
44-
$grant_option = '-WITH_GRANT_OPTION'
43+
$_grant_option = $with_grant_option ? {
44+
true => '-WITH_GRANT_OPTION',
45+
default => ''
4546
}
46-
sqlserver_tsql{ "login-permission-${instance}-${login}-${_state}${grant_option}":
47+
sqlserver_tsql{ "login-permission-${instance}-${login}-${_state}${_grant_option}":
4748
instance => $instance,
4849
command => template('sqlserver/create/login/permission.sql.erb'),
4950
onlyif => template('sqlserver/query/login/permission_exists.sql.erb'),

manifests/user/permissions.pp

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@
5353

5454
sqlserver_validate_range($user, 1, 128, 'User must be between 1 and 128 characters')
5555

56-
if $with_grant_option {
57-
$grant_option = '-WITH_GRANT_OPTION'
56+
$_grant_option = $with_grant_option ? {
57+
true => '-WITH_GRANT_OPTION',
58+
default => ''
5859
}
5960
sqlserver_tsql{
60-
"user-permissions-${instance}-${database}-${user}-${_state}${grant_option}":
61+
"user-permissions-${instance}-${database}-${user}-${_state}${_grant_option}":
6162
instance => $instance,
6263
command => template('sqlserver/create/user/permission.sql.erb'),
6364
onlyif => template('sqlserver/query/user/permission_exists.sql.erb'),

0 commit comments

Comments
 (0)