Skip to content

Commit

Permalink
Merge pull request #469 from puppetlabs/CAT-1728-deferred-function-un…
Browse files Browse the repository at this point in the history
…defined

(CAT-1728) - Unable to use password function as deferred function
  • Loading branch information
Ramesh7 committed Feb 22, 2024
2 parents 931b98c + ed97d7c commit 959fb12
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Publish module"

on:
workflow_dispatch:

jobs:
release:
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main"
Expand Down
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ Lint/DuplicateBranch:
Enabled: false
Lint/DuplicateMagicComment:
Enabled: false
Lint/DuplicateMatchPattern:
Enabled: false
Lint/DuplicateRegexpCharacterClassElement:
Enabled: false
Lint/EmptyBlock:
Expand Down Expand Up @@ -645,6 +647,8 @@ Style/ComparableClamp:
Enabled: false
Style/ConcatArrayLiterals:
Enabled: false
Style/DataInheritance:
Enabled: false
Style/DirEmpty:
Enabled: false
Style/DocumentDynamicEvalDefinition:
Expand Down Expand Up @@ -713,6 +717,8 @@ Style/RedundantHeredocDelimiterQuotes:
Enabled: false
Style/RedundantInitialize:
Enabled: false
Style/RedundantLineContinuation:
Enabled: false
Style/RedundantSelfAssignmentBranch:
Enabled: false
Style/RedundantStringEscape:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"puppet.puppet-vscode",
"rebornix.Ruby"
"Shopify.ruby-lsp"
]
}
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ group :development do
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
gem "facterdb", '~> 1.18', require: false
gem "metadata-json-lint", '~> 3.0', require: false
gem "metadata-json-lint", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 6.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "codecov", '~> 0.2', require: false
gem "dependency_checker", '~> 1.0.0', require: false
gem "parallel_tests", '= 3.12.1', require: false
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.5', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "rubocop", '= 1.48.1', require: false
gem "rubocop", '~> 1.50.0', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "puppet-strings", '~> 4.0', require: false
Expand Down
19 changes: 0 additions & 19 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
### Functions

* [`sqlserver::partial_params_args`](#sqlserver--partial_params_args): this function populates and returns the string of arguments which later gets injected in template.
* [`sqlserver::password`](#sqlserver--password): This function exists for usage of a role password that is a deferred function
* [`sqlserver_is_domain_or_local_user`](#sqlserver_is_domain_or_local_user)
* [`sqlserver_upcase`](#sqlserver_upcase)
* [`sqlserver_validate_hash_uniq_values`](#sqlserver_validate_hash_uniq_values)
Expand Down Expand Up @@ -1236,24 +1235,6 @@ Optional[Enum['ON', 'OFF']] $nested_triggers
Optional[Enum['ON', 'OFF']] $transform_noise_words
Integer[1753, 9999] $two_digit_year_cutoff

### <a name="sqlserver--password"></a>`sqlserver::password`

Type: Ruby 4.x API

This function exists for usage of a role password that is a deferred function

#### `sqlserver::password(Optional[Any] $pass)`

This function exists for usage of a role password that is a deferred function

Returns: `Any`

##### `pass`

Data type: `Optional[Any]`



### <a name="sqlserver_is_domain_or_local_user"></a>`sqlserver_is_domain_or_local_user`

Type: Ruby 3.x API
Expand Down
13 changes: 0 additions & 13 deletions lib/puppet/functions/sqlserver/password.rb

This file was deleted.

5 changes: 4 additions & 1 deletion manifests/login.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
$create_delete_login_parameters = {
'disabled' => $disabled,
'login' => $login,
'password' => Deferred('sqlserver::password', [$password]),
'password' => $password ? {
undef => undef,
default => Deferred('sprintf', [$password]),
},
'check_expiration' => $check_expiration,
'check_policy' => $check_policy,
'default_language' => $default_language,
Expand Down
5 changes: 4 additions & 1 deletion manifests/user.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@
if $create_delete == 'create' {
$create_delete_user_parameters = {
'database' => $database,
'password' => Deferred('sqlserver::password', [$password]),
'password' => $password ? {
undef => undef,
default => Deferred('sprintf', [$password]),
},
'user' => $user,
'login' => $login,
'default_schema' => $default_schema,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
],
"pdk-version": "3.0.0",
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
"template-ref": "heads/main-0-g79a2f93"
"template-ref": "heads/main-0-g0f7378b"
}
8 changes: 0 additions & 8 deletions spec/functions/password_spec.rb

This file was deleted.

0 comments on commit 959fb12

Please sign in to comment.