Skip to content

Commit 39b7bde

Browse files
authored
Merge pull request #1299 from alexjfisher/remove_legacy_mysql_password_function
Remove legacy (old API) `mysql_password` function
2 parents dd49fdd + 5a70627 commit 39b7bde

File tree

6 files changed

+34
-64
lines changed

6 files changed

+34
-64
lines changed

REFERENCE.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ _Private Resource types_
6060
then returns the resulting hash.
6161
* [`mysql::password`](#mysqlpassword): Hash a string as mysql's "PASSWORD()" function would do it
6262
* [`mysql::strip_hash`](#mysqlstrip_hash): When given a hash this function strips out all blank entries.
63-
* [`mysql_password`](#mysql_password): Hash a string as mysql's "PASSWORD()" function would do it
63+
* [`mysql_password`](#mysql_password): DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead.
6464

6565
**Tasks**
6666

@@ -1176,7 +1176,7 @@ Default value: present
11761176

11771177
Valid values: %r{\w*}
11781178

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

11811181
##### `plugin`
11821182

@@ -1310,15 +1310,15 @@ Hash to be stripped
13101310

13111311
### mysql_password
13121312

1313-
Type: Ruby 3.x API
1313+
Type: Ruby 4.x API
13141314

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

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

13191319
The mysql_password function.
13201320

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

13231323
##### `password`
13241324

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# @summary DEPRECATED. Use the namespaced function [`mysql::password`](#mysqlpassword) instead.
2+
Puppet::Functions.create_function(:mysql_password) do
3+
# @param password
4+
# Plain text password.
5+
#
6+
# @return
7+
# The mysql password hash from the 4.x function mysql::password.
8+
dispatch :mysql_password do
9+
required_param 'String', :password
10+
return_type 'String'
11+
end
12+
13+
def mysql_password(password)
14+
call_function('deprecation', 'mysql_password', "This method has been deprecated, please use the namespaced version 'mysql::password' instead.")
15+
call_function('mysql::password', password)
16+
end
17+
end

lib/puppet/parser/functions/mysql_password.rb

-21
This file was deleted.

lib/puppet/type/mysql_user.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
end
4848

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

5353
def change_to_s(currentvalue, _newvalue)

spec/functions/mysql_password_spec.rb

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
describe 'mysql::password' do
3+
shared_examples 'mysql::password function' do
44
it 'exists' do
55
is_expected.not_to eq(nil)
66
end
@@ -29,3 +29,13 @@
2929
is_expected.to run.with_params('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19').and_return('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19')
3030
end
3131
end
32+
33+
describe 'mysql::password' do
34+
it_behaves_like 'mysql::password function'
35+
36+
describe 'non-namespaced shim' do
37+
describe 'mysql_password', type: :puppet_function do
38+
it_behaves_like 'mysql::password function'
39+
end
40+
end
41+
end

spec/unit/puppet/functions/mysql_password_spec.rb

-36
This file was deleted.

0 commit comments

Comments
 (0)