diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 7370adee..cc96ece0 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,4 +1 @@ --relative ---no-parameter_types-check ---no-params_empty_string_assignment-check ---no-unquoted_string_in_selector-check diff --git a/.sync.yml b/.sync.yml index 6b3451a8..d229f224 100644 --- a/.sync.yml +++ b/.sync.yml @@ -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 diff --git a/Rakefile b/Rakefile index f128fece..0f8754eb 100644 --- a/Rakefile +++ b/Rakefile @@ -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? diff --git a/manifests/config.pp b/manifests/config.pp index bc8053fd..5b6de940 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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}" } } diff --git a/manifests/database.pp b/manifests/database.pp index bb175364..87564176 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -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}": diff --git a/manifests/login.pp b/manifests/login.pp index ad77e9e1..dba55fa1 100644 --- a/manifests/login.pp +++ b/manifests/login.pp @@ -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', @@ -72,8 +72,8 @@ } $_create_delete = $ensure ? { - present => 'create', - absent => 'delete', + 'present' => 'create', + 'absent' => 'delete', } sqlserver_tsql { "login-${instance}-${login}": diff --git a/manifests/role.pp b/manifests/role.pp index 2e324558..54719d2b 100644 --- a/manifests/role.pp +++ b/manifests/role.pp @@ -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 diff --git a/manifests/user.pp b/manifests/user.pp index bdfd7db8..2cdf0ddd 100644 --- a/manifests/user.pp +++ b/manifests/user.pp @@ -58,8 +58,8 @@ } $create_delete = $ensure ? { - present => 'create', - absent => 'delete', + 'present' => 'create', + 'absent' => 'delete', } sqlserver_tsql { "user-${instance}-${database}-${user}": diff --git a/templates/instance_config.erb b/templates/instance_config.erb index 7f37b5f9..9b9f75ad 100644 --- a/templates/instance_config.erb +++ b/templates/instance_config.erb @@ -1 +1,5 @@ +<%- if @admin_login_type == 'SQL_LOGIN' %> { "instance": "<%= @_instance %>","admin":"<%= @admin_user %>","pass":"<%= @admin_pass %>" } +<%- else %> +{ "instance": "<%= @_instance %>","admin":"","pass":"" } +<%- end %>