Skip to content

Fix broken sensitive parameter for mysql::password #1564

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 2 commits into from
May 10, 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
2 changes: 1 addition & 1 deletion lib/puppet/functions/mysql/password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
return_type 'Variant[String, Sensitive[String]]'
end

def password(password, sensitive: false)
def password(password, sensitive = false) # rubocop:disable Style/OptionalBooleanParameter
password = password.unwrap if password.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)

result_string = if %r{\*[A-F0-9]{40}$}.match?(password)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/functions/mysql_password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
return_type 'Variant[String, Sensitive[String]]'
end

def mysql_password(password, sensitive: false)
def mysql_password(password, sensitive = false) # rubocop:disable Style/OptionalBooleanParameter
call_function('deprecation', 'mysql_password', "This method has been deprecated, please use the namespaced version 'mysql::password' instead.")
call_function('mysql::password', password, sensitive)
end
Expand Down
1 change: 0 additions & 1 deletion spec/functions/mysql_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

# Test of a Returnvalue of Datatype Sensitive does not work
it 'returns Sensitive with sensitive=true' do
skip 'should have a Returnvalue of Datatype Sensitive'
expect(subject).to run.with_params('password', true).and_return(sensitive('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
end

Expand Down