Skip to content
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

Remove legacy (old API) mysql_password function #1299

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
10 changes: 5 additions & 5 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _Private Resource types_
then returns the resulting hash.
* [`mysql::password`](#mysqlpassword): Hash a string as mysql's "PASSWORD()" function would do it
* [`mysql::strip_hash`](#mysqlstrip_hash): When given a hash this function strips out all blank entries.
* [`mysql_password`](#mysql_password): Hash a string as mysql's "PASSWORD()" function would do it
* [`mysql_password`](#mysql_password): DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead.

**Tasks**

Expand Down Expand Up @@ -1176,7 +1176,7 @@ Default value: present

Valid values: %r{\w*}

The password hash of the user. Use mysql_password() for creating such a hash.
The password hash of the user. Use mysql::password() for creating such a hash.

##### `plugin`

Expand Down Expand Up @@ -1310,15 +1310,15 @@ Hash to be stripped

### mysql_password

Type: Ruby 3.x API
Type: Ruby 4.x API

Hash a string as mysql's "PASSWORD()" function would do it
DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead.

#### `mysql_password(String $password)`

The mysql_password function.

Returns: `String` the mysql password hash from the clear text password.
Returns: `String` The mysql password hash from the 4.x function mysql::password.

##### `password`

Expand Down
17 changes: 17 additions & 0 deletions lib/puppet/functions/mysql_password.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @summary DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead.
Puppet::Functions.create_function(:mysql_password) do
# @param password
# Plain text password.
#
# @return
# The mysql password hash from the 4.x function mysql::password.
dispatch :mysql_password do
required_param 'String', :password
return_type 'String'
end

def mysql_password(password)
call_function('deprecation', 'mysql_password', "This method has been deprecated, please use the namespaced version 'mysql::password' instead.")
call_function('mysql::password', password)
end
end
21 changes: 0 additions & 21 deletions lib/puppet/parser/functions/mysql_password.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/puppet/type/mysql_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
end

newproperty(:password_hash) do
desc 'The password hash of the user. Use mysql_password() for creating such a hash.'
desc 'The password hash of the user. Use mysql::password() for creating such a hash.'
newvalue(%r{\w*})

def change_to_s(currentvalue, _newvalue)
Expand Down
12 changes: 11 additions & 1 deletion spec/functions/mysql_password_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'mysql::password' do
shared_examples 'mysql::password function' do
it 'exists' do
is_expected.not_to eq(nil)
end
Expand Down Expand Up @@ -29,3 +29,13 @@
is_expected.to run.with_params('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19').and_return('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19')
end
end

describe 'mysql::password' do
it_behaves_like 'mysql::password function'

describe 'non-namespaced shim' do
describe 'mysql_password', type: :puppet_function do
it_behaves_like 'mysql::password function'
end
end
end
36 changes: 0 additions & 36 deletions spec/unit/puppet/functions/mysql_password_spec.rb

This file was deleted.