Skip to content

Commit 13a0b1c

Browse files
author
tphoney
committed
Updated pot file, decorated simple strings
1 parent 6b1aa77 commit 13a0b1c

File tree

9 files changed

+53
-49
lines changed

9 files changed

+53
-49
lines changed

lib/puppet/parser/functions/mysql_strip_hash.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Puppet::Parser::Functions
88

99
hash = args[0]
1010
unless hash.is_a?(Hash)
11-
raise(Puppet::ParseError, 'mysql_strip_hash(): Requires hash to work with')
11+
raise(Puppet::ParseError, _('mysql_strip_hash(): Requires a hash to work.'))
1212
end
1313

1414
# Filter out all the top level blanks.

lib/puppet/provider/mysql_datadir/mysql.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create
5656

5757
def destroy
5858
name = @resource[:name] # rubocop:disable Lint/UselessAssignment
59-
raise ArgumentError, 'ERROR: Resource can not be removed'
59+
raise ArgumentError, _('ERROR: `Resource` can not be removed.')
6060
end
6161

6262
def exists?

lib/puppet/provider/mysql_user/mysql.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def password_hash=(string)
122122
# default ... if mysqld_version does not work
123123
mysql([defaults_file, system_database, '-e', "SET PASSWORD FOR #{merged_name} = '#{string}'"].compact)
124124
elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0
125-
raise ArgumentError, 'Only mysql_native_password (*ABCD...XXX) hashes are supported' unless string =~ %r{^\*}
125+
raise ArgumentError, _('Only mysql_native_password (*ABCD...XXX) hashes are supported.') unless string =~ %r{^\*}
126126
mysql([defaults_file, system_database, '-e', "ALTER USER #{merged_name} IDENTIFIED WITH mysql_native_password AS '#{string}'"].compact)
127127
else
128128
mysql([defaults_file, system_database, '-e', "SET PASSWORD FOR #{merged_name} = '#{string}'"].compact)

lib/puppet/type/mysql_grant.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def initialize(*args)
3131
end
3232
# rubocop:enable Style/MultilineBlockChain
3333
validate do
34-
raise('privileges parameter is required.') if self[:ensure] == :present && self[:privileges].nil?
35-
raise('PROXY must be the only privilege specified.') if Array(self[:privileges]).count > 1 && Array(self[:privileges]).include?('PROXY')
36-
raise('table parameter is required.') if self[:ensure] == :present && self[:table].nil?
37-
raise('user parameter is required.') if self[:ensure] == :present && self[:user].nil?
34+
raise(_('`privileges` `parameter` is required.')) if self[:ensure] == :present && self[:privileges].nil?
35+
raise(_('`privileges` `parameter`: PROXY can only be specified by itself.')) if Array(self[:privileges]).count > 1 && Array(self[:privileges]).include?('PROXY')
36+
raise(_('`table` `parameter` is required.')) if self[:ensure] == :present && self[:table].nil?
37+
raise(_('`user` `parameter` is required.')) if self[:ensure] == :present && self[:user].nil?
3838
if self[:user] && self[:table]
39-
raise('name must match user@host/table format') if self[:name] != "#{self[:user]}/#{self[:table]}"
39+
raise(_('`name` `parameter` must match user@host/table format.')) if self[:name] != "#{self[:user]}/#{self[:table]}"
4040
end
4141
end
4242

@@ -63,7 +63,7 @@ def initialize(*args)
6363
desc 'Table to apply privileges to.'
6464

6565
validate do |value|
66-
raise(ArgumentError, '"table" for PROXY should be specified as proxy_user@proxy_host') if Array(@resource[:privileges]).include?('PROXY') && !%r{^[0-9a-zA-Z$_]*@[\w%\.:\-\/]*$}.match(value)
66+
raise(ArgumentError, _('`table` `property` should be specified as proxy_user@proxy_host .')) if Array(@resource[:privileges]).include?('PROXY') && !%r{^[0-9a-zA-Z$_]*@[\w%\.:\-\/]*$}.match(value)
6767
end
6868

6969
munge do |value|
@@ -97,9 +97,9 @@ def initialize(*args)
9797
# rubocop:enable Lint/UselessAssignment
9898
mysql_version = Facter.value(:mysql_version)
9999
unless mysql_version.nil?
100-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 16 characters') if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
101-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 32 characters') if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
102-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 80 characters') if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
100+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 16 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
101+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 32 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
102+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 80 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
103103
end
104104
end
105105

lib/puppet/type/mysql_user.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
# rubocop:enable Lint/AssignmentInCondition
3232
# rubocop:enable Lint/UselessAssignment
3333
unless mysql_version.nil?
34-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 16 characters') if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
35-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 32 characters') if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
36-
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 80 characters') if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
34+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 16 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
35+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 32 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
36+
raise(ArgumentError, _('MySQL usernames are limited to a maximum of 80 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
3737
end
3838
end
3939

@@ -79,7 +79,7 @@
7979
value = [value] unless value.is_a?(Array)
8080
if value.include?('NONE') || value.include?('SSL') || value.include?('X509')
8181
if value.length > 1
82-
raise(ArgumentError, 'REQUIRE tls options NONE, SSL and X509 cannot be used with other options, you may only use one of them.')
82+
raise(ArgumentError, _('`tls_options` `property`: The values NONE, SSL and X509 cannot be used with other options, you may only pick one of them.'))
8383
end
8484
else
8585
value.each do |opt|

locales/puppetlabs-mysql.pot

+31-27
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ msgstr ""
1414
"X-Generator: Translate Toolkit 2.0.0\n"
1515

1616
#. ./manifests/server.pp:48
17-
msgid "old_root_password is no longer used and will be removed in a future release"
17+
msgid ""
18+
"The `old_root_password` attribute is no longer used and will be removed in a f"
19+
"uture release."
1820
msgstr ""
1921

2022
#. metadata.json
@@ -27,54 +29,56 @@ msgstr ""
2729
msgid "MySQL module"
2830
msgstr ""
2931

30-
#: ../lib/puppet/parser/functions/mysql_strip_hash.rb:11
31-
msgid "mysql_strip_hash(): Requires hash to work with"
32+
#: ./lib/puppet/parser/functions/mysql_strip_hash.rb:11
33+
msgid "mysql_strip_hash(): Requires a hash to work."
3234
msgstr ""
3335

34-
#: ../lib/puppet/provider/mysql_datadir/mysql.rb:59
35-
msgid "ERROR: Resource can not be removed"
36+
#: ./lib/puppet/provider/mysql_datadir/mysql.rb:59
37+
msgid "ERROR: `Resource` can not be removed."
3638
msgstr ""
3739

38-
#: ../lib/puppet/provider/mysql_user/mysql.rb:125
39-
msgid "Only mysql_native_password (*ABCD...XXX) hashes are supported"
40+
#: ./lib/puppet/provider/mysql_user/mysql.rb:125
41+
msgid "Only mysql_native_password (*ABCD...XXX) hashes are supported."
4042
msgstr ""
4143

42-
#: ../lib/puppet/type/mysql_grant.rb:34
43-
msgid "privileges parameter is required."
44+
#: ./lib/puppet/type/mysql_grant.rb:34
45+
msgid "`privileges` `parameter` is required."
4446
msgstr ""
4547

46-
#: ../lib/puppet/type/mysql_grant.rb:35
47-
msgid "PROXY must be the only privilege specified."
48+
#: ./lib/puppet/type/mysql_grant.rb:35
49+
msgid "`privileges` `parameter`: PROXY can only be specified by itself."
4850
msgstr ""
4951

50-
#: ../lib/puppet/type/mysql_grant.rb:36
51-
msgid "table parameter is required."
52+
#: ./lib/puppet/type/mysql_grant.rb:36
53+
msgid "`table` `parameter` is required."
5254
msgstr ""
5355

54-
#: ../lib/puppet/type/mysql_grant.rb:37
55-
msgid "user parameter is required."
56+
#: ./lib/puppet/type/mysql_grant.rb:37
57+
msgid "`user` `parameter` is required."
5658
msgstr ""
5759

58-
#: ../lib/puppet/type/mysql_grant.rb:39
59-
msgid "name must match user@host/table format"
60+
#: ./lib/puppet/type/mysql_grant.rb:39
61+
msgid "`name` `parameter` must match user@host/table format."
6062
msgstr ""
6163

62-
#: ../lib/puppet/type/mysql_grant.rb:66
63-
msgid "\"table\" for PROXY should be specified as proxy_user@proxy_host"
64+
#: ./lib/puppet/type/mysql_grant.rb:66
65+
msgid "`table` `property` should be specified as proxy_user@proxy_host ."
6466
msgstr ""
6567

66-
#: ../lib/puppet/type/mysql_grant.rb:100 ../lib/puppet/type/mysql_user.rb:34
67-
msgid "MySQL usernames are limited to a maximum of 16 characters"
68+
#: ./lib/puppet/type/mysql_grant.rb:100 ./lib/puppet/type/mysql_user.rb:34
69+
msgid "MySQL usernames are limited to a maximum of 16 characters."
6870
msgstr ""
6971

70-
#: ../lib/puppet/type/mysql_grant.rb:101 ../lib/puppet/type/mysql_user.rb:35
71-
msgid "MySQL usernames are limited to a maximum of 32 characters"
72+
#: ./lib/puppet/type/mysql_grant.rb:101 ./lib/puppet/type/mysql_user.rb:35
73+
msgid "MySQL usernames are limited to a maximum of 32 characters."
7274
msgstr ""
7375

74-
#: ../lib/puppet/type/mysql_grant.rb:102 ../lib/puppet/type/mysql_user.rb:36
75-
msgid "MySQL usernames are limited to a maximum of 80 characters"
76+
#: ./lib/puppet/type/mysql_grant.rb:102 ./lib/puppet/type/mysql_user.rb:36
77+
msgid "MySQL usernames are limited to a maximum of 80 characters."
7678
msgstr ""
7779

78-
#: ../lib/puppet/type/mysql_user.rb:82
79-
msgid "REQUIRE tls options NONE, SSL and X509 cannot be used with other options, you may only use one of them."
80+
#: ./lib/puppet/type/mysql_user.rb:82
81+
msgid ""
82+
"`tls_options` `property`: The values NONE, SSL and X509 cannot be used with ot"
83+
"her options, you may only pick one of them."
8084
msgstr ""

manifests/server.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
$real_service_manage = $service_manage
4646
}
4747
if $old_root_password {
48-
warning('old_root_password is no longer used and will be removed in a future release')
48+
warning(translate('The `old_root_password` attribute is no longer used and will be removed in a future release.'))
4949
}
5050

5151
# Create a merged together set of options. Rightmost hashes win over left.

spec/acceptance/types/mysql_grant_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class { 'mysql::server':
2727
}
2828
EOS
2929

30-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/privileges parameter is required/)
30+
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/`privileges` `parameter` is required/)
3131
end
3232

3333
it 'should not find the user' do
@@ -151,7 +151,7 @@ class { 'mysql::server':
151151
}
152152
EOS
153153

154-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/table parameter is required./)
154+
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/`table` `parameter` is required./)
155155
end
156156
end
157157

@@ -492,7 +492,7 @@ class { 'mysql::server':
492492
}
493493
EOS
494494

495-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/PROXY must be the only privilege specified/)
495+
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/`privileges` `parameter`: PROXY can only be specified by itself/)
496496
end
497497

498498
it 'should not find the user' do
@@ -538,7 +538,7 @@ class { 'mysql::server':
538538
}
539539
EOS
540540

541-
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/"table" for PROXY should be specified as proxy_user@proxy_host/)
541+
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/`table` `property` should be specified as proxy_user@proxy_host/)
542542
end
543543

544544
it 'should not find the user' do

spec/unit/puppet/type/mysql_grant_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
}.to_not raise_error
7373
expect {
7474
Puppet::Type.type(:mysql_grant).new(:name => 'foo', :privileges => ['ALL'], :table => ['*.*'], :user => 'foo@localhost')
75-
}.to raise_error /name must match user@host\/table format/
75+
}.to raise_error /`name` `parameter` must match user@host\/table format/
7676
end
7777

7878
describe 'it should munge privileges' do

0 commit comments

Comments
 (0)