Skip to content

Commit c257a32

Browse files
committed
(MODULES-4604) move name validation in mysql_grant type
Users are running into an issue where \`puppet resource mysql_grant\` fails because there is a global name validation using properties that only exist in a compiled catalog and not in the naked type that is instantiated during a \`puppet resource\` run. This moves name validation into the \`name\` parameter in the mysql_grant type. See also #522
1 parent 99738fc commit c257a32

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/puppet/type/mysql_grant.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ def initialize(*args)
3434
fail('PROXY must be the only privilege specified.') if Array(self[:privileges]).count > 1 and Array(self[:privileges]).include?('PROXY')
3535
fail('table parameter is required.') if self[:ensure] == :present and self[:table].nil?
3636
fail('user parameter is required.') if self[:ensure] == :present and self[:user].nil?
37-
fail('name must match user and table parameters') if self[:name] != "#{self[:user]}/#{self[:table]}"
3837
end
3938

4039
newparam(:name, :namevar => true) do
4140
desc 'Name to describe the grant.'
4241

42+
validate do |value|
43+
fail("name must match user@host/table format. got #{value} instead") unless value.match(/^.*@.*\/.*$/)
44+
end
45+
4346
munge do |value|
4447
value.delete("'")
4548
end

0 commit comments

Comments
 (0)