Skip to content

Commit 6ebbac4

Browse files
authored
Merge pull request #421 from puppetlabs/CONT-365-Syntax_update
(CONT-365) Syntax update
2 parents 41fb365 + 6fe3c9a commit 6ebbac4

File tree

9 files changed

+21
-28
lines changed

9 files changed

+21
-28
lines changed

.puppet-lint.rc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
--relative
2-
--no-parameter_types-check
3-
--no-params_empty_string_assignment-check
4-
--no-unquoted_string_in_selector-check

.sync.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,3 @@ spec/spec_helper.rb:
3232
unmanaged: false
3333
.travis.yml:
3434
delete: true
35-
Rakefile:
36-
extra_disabled_lint_checks:
37-
- parameter_types
38-
- params_empty_string_assignment
39-
- unquoted_string_in_selector

Rakefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ def changelog_future_release
4242
end
4343

4444
PuppetLint.configuration.send('disable_relative')
45-
PuppetLint.configuration.send('disable_parameter_types')
46-
PuppetLint.configuration.send('disable_params_empty_string_assignment')
47-
PuppetLint.configuration.send('disable_unquoted_string_in_selector')
4845

4946

5047
if Bundler.rubygems.find_name('github_changelog_generator').any?

manifests/config.pp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222
# }
2323
#
2424
define sqlserver::config (
25-
Variant[Sensitive[String], String] $admin_user = '',
26-
Variant[Sensitive[String], String] $admin_pass = '',
27-
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $admin_login_type = 'SQL_LOGIN',
28-
String[1,16] $instance_name = $title,
25+
Optional[Variant[Sensitive[String], String]] $admin_user = undef,
26+
Optional[Variant[Sensitive[String], String]] $admin_pass = undef,
27+
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $admin_login_type = 'SQL_LOGIN',
28+
String[1,16] $instance_name = $title,
2929
) {
3030
##This config is a catalog requirement for sqlserver_tsql and is looked up to retrieve the admin_user,
3131
## admin_pass and admin_login_type for a given instance_name
3232

3333
case $admin_login_type {
3434
'SQL_LOGIN': {
35-
if ($admin_user == '') { fail 'sqlserver::config expects admin_user to be set for a admin_login_type of SQL_LOGIN' }
36-
if ($admin_pass == '') { fail 'sqlserver::config expects admin_pass to be set for a admin_login_type of SQL_LOGIN' }
35+
if (!$admin_user) { fail 'sqlserver::config expects admin_user to be set for a admin_login_type of SQL_LOGIN' }
36+
if (!$admin_pass) { fail 'sqlserver::config expects admin_pass to be set for a admin_login_type of SQL_LOGIN' }
3737
}
3838
'WINDOWS_LOGIN': {
39-
if ($admin_user != '') { fail 'sqlserver::config expects admin_user to be empty for a admin_login_type of WINDOWS_LOGIN' }
40-
if ($admin_pass != '') { fail 'sqlserver::config expects admin_pass to be empty for a admin_login_type of WINDOWS_LOGIN' }
39+
if ($admin_user) { fail 'sqlserver::config expects admin_user to be empty for a admin_login_type of WINDOWS_LOGIN' }
40+
if ($admin_pass) { fail 'sqlserver::config expects admin_pass to be empty for a admin_login_type of WINDOWS_LOGIN' }
4141
}
4242
default: { fail "sqlserver::config expects a admin_login_type of SQL_LOGIN or WINDOWS_LOGIN but found ${admin_login_type}" }
4343
}

manifests/database.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@
175175
sqlserver_validate_instance_name($instance)
176176

177177
$create_delete = $ensure ? {
178-
present => 'create',
179-
absent => 'delete',
178+
'present' => 'create',
179+
'absent' => 'delete',
180180
}
181181

182182
sqlserver_tsql { "database-${instance}-${db_name}":

manifests/login.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#
5353
##
5454
define sqlserver::login (
55-
$login = $title,
55+
String[1, 128] $login = $title,
5656
String[1,16] $instance = 'MSSQLSERVER',
5757
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $login_type = 'SQL_LOGIN',
5858
Enum['present', 'absent'] $ensure = 'present',
@@ -72,8 +72,8 @@
7272
}
7373

7474
$_create_delete = $ensure ? {
75-
present => 'create',
76-
absent => 'delete',
75+
'present' => 'create',
76+
'absent' => 'delete',
7777
}
7878

7979
sqlserver_tsql { "login-${instance}-${login}":

manifests/role.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
}
5454

5555
$_create_delete = $ensure ? {
56-
present => 'create',
57-
absent => 'delete',
56+
'present' => 'create',
57+
'absent' => 'delete',
5858
}
5959

6060
# the title has to be unique to prevent collisions when multiple declarations

manifests/user.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
}
5959

6060
$create_delete = $ensure ? {
61-
present => 'create',
62-
absent => 'delete',
61+
'present' => 'create',
62+
'absent' => 'delete',
6363
}
6464

6565
sqlserver_tsql { "user-${instance}-${database}-${user}":

templates/instance_config.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
<%- if @admin_login_type == 'SQL_LOGIN' %>
12
{ "instance": "<%= @_instance %>","admin":"<%= @admin_user %>","pass":"<%= @admin_pass %>" }
3+
<%- else %>
4+
{ "instance": "<%= @_instance %>","admin":"","pass":"" }
5+
<%- end %>

0 commit comments

Comments
 (0)