Skip to content

(CONT-365) Syntax update #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
--relative
--no-parameter_types-check
--no-params_empty_string_assignment-check
--no-unquoted_string_in_selector-check
5 changes: 0 additions & 5 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,3 @@ spec/spec_helper.rb:
unmanaged: false
.travis.yml:
delete: true
Rakefile:
extra_disabled_lint_checks:
- parameter_types
- params_empty_string_assignment
- unquoted_string_in_selector
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ def changelog_future_release
end

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_parameter_types')
PuppetLint.configuration.send('disable_params_empty_string_assignment')
PuppetLint.configuration.send('disable_unquoted_string_in_selector')


if Bundler.rubygems.find_name('github_changelog_generator').any?
Expand Down
16 changes: 8 additions & 8 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
# }
#
define sqlserver::config (
Variant[Sensitive[String], String] $admin_user = '',
Variant[Sensitive[String], String] $admin_pass = '',
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $admin_login_type = 'SQL_LOGIN',
String[1,16] $instance_name = $title,
Optional[Variant[Sensitive[String], String]] $admin_user = undef,
Optional[Variant[Sensitive[String], String]] $admin_pass = undef,
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $admin_login_type = 'SQL_LOGIN',
String[1,16] $instance_name = $title,
) {
##This config is a catalog requirement for sqlserver_tsql and is looked up to retrieve the admin_user,
## admin_pass and admin_login_type for a given instance_name

case $admin_login_type {
'SQL_LOGIN': {
if ($admin_user == '') { fail 'sqlserver::config expects admin_user to be set for a admin_login_type of SQL_LOGIN' }
if ($admin_pass == '') { fail 'sqlserver::config expects admin_pass to be set for a admin_login_type of SQL_LOGIN' }
if (!$admin_user) { fail 'sqlserver::config expects admin_user to be set for a admin_login_type of SQL_LOGIN' }
if (!$admin_pass) { fail 'sqlserver::config expects admin_pass to be set for a admin_login_type of SQL_LOGIN' }
}
'WINDOWS_LOGIN': {
if ($admin_user != '') { fail 'sqlserver::config expects admin_user to be empty for a admin_login_type of WINDOWS_LOGIN' }
if ($admin_pass != '') { fail 'sqlserver::config expects admin_pass to be empty for a admin_login_type of WINDOWS_LOGIN' }
if ($admin_user) { fail 'sqlserver::config expects admin_user to be empty for a admin_login_type of WINDOWS_LOGIN' }
if ($admin_pass) { fail 'sqlserver::config expects admin_pass to be empty for a admin_login_type of WINDOWS_LOGIN' }
}
default: { fail "sqlserver::config expects a admin_login_type of SQL_LOGIN or WINDOWS_LOGIN but found ${admin_login_type}" }
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
sqlserver_validate_instance_name($instance)

$create_delete = $ensure ? {
present => 'create',
absent => 'delete',
'present' => 'create',
'absent' => 'delete',
}

sqlserver_tsql { "database-${instance}-${db_name}":
Expand Down
6 changes: 3 additions & 3 deletions manifests/login.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#
##
define sqlserver::login (
$login = $title,
String[1, 128] $login = $title,
String[1,16] $instance = 'MSSQLSERVER',
Enum['SQL_LOGIN', 'WINDOWS_LOGIN'] $login_type = 'SQL_LOGIN',
Enum['present', 'absent'] $ensure = 'present',
Expand All @@ -72,8 +72,8 @@
}

$_create_delete = $ensure ? {
present => 'create',
absent => 'delete',
'present' => 'create',
'absent' => 'delete',
}

sqlserver_tsql { "login-${instance}-${login}":
Expand Down
4 changes: 2 additions & 2 deletions manifests/role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
}

$_create_delete = $ensure ? {
present => 'create',
absent => 'delete',
'present' => 'create',
'absent' => 'delete',
}

# the title has to be unique to prevent collisions when multiple declarations
Expand Down
4 changes: 2 additions & 2 deletions manifests/user.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
}

$create_delete = $ensure ? {
present => 'create',
absent => 'delete',
'present' => 'create',
'absent' => 'delete',
}

sqlserver_tsql { "user-${instance}-${database}-${user}":
Expand Down
4 changes: 4 additions & 0 deletions templates/instance_config.erb
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<%- if @admin_login_type == 'SQL_LOGIN' %>
{ "instance": "<%= @_instance %>","admin":"<%= @admin_user %>","pass":"<%= @admin_pass %>" }
<%- else %>
{ "instance": "<%= @_instance %>","admin":"","pass":"" }
<%- end %>