puppet 5.3.2 → 5.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/Gemfile +5 -1
- data/Rakefile +9 -4
- data/lib/puppet.rb +4 -5
- data/lib/puppet/external/nagios/grammar.ry +1 -1
- data/lib/puppet/external/nagios/parser.rb +1 -1
- data/lib/puppet/forge.rb +9 -3
- data/lib/puppet/forge/repository.rb +1 -1
- data/lib/puppet/gettext/config.rb +86 -28
- data/lib/puppet/graph/relationship_graph.rb +6 -0
- data/lib/puppet/indirector/catalog/compiler.rb +25 -5
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/module.rb +9 -18
- data/lib/puppet/pops/types/p_binary_type.rb +9 -2
- data/lib/puppet/pops/types/p_object_type.rb +9 -3
- data/lib/puppet/pops/types/ruby_generator.rb +65 -24
- data/lib/puppet/provider/service/base.rb +21 -8
- data/lib/puppet/provider/zfs/zfs.rb +5 -1
- data/lib/puppet/util/windows/file.rb +35 -4
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +92 -64
- data/locales/puppet.pot +28 -24
- data/spec/fixtures/unit/provider/service/base/ps_ef.mixed_encoding +3 -0
- data/spec/integration/file_bucket/file_spec.rb +20 -5
- data/spec/integration/transaction_spec.rb +35 -2
- data/spec/unit/forge/forge_spec.rb +2 -2
- data/spec/unit/forge_spec.rb +105 -0
- data/spec/unit/gettext_config_spec.rb +4 -4
- data/spec/unit/graph/relationship_graph_spec.rb +15 -0
- data/spec/unit/module_spec.rb +8 -13
- data/spec/unit/pops/types/ruby_generator_spec.rb +192 -0
- data/spec/unit/provider/service/base_spec.rb +20 -0
- data/spec/unit/provider/zfs/zfs_spec.rb +7 -1
- data/spec/unit/type/nagios_spec.rb +21 -1
- metadata +3374 -3382
data/locales/puppet.pot
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: Puppet automation framework 5.3.
|
9
|
+
"Project-Id-Version: Puppet automation framework 5.3.2-73-g035eee5\n"
|
10
10
|
"\n"
|
11
11
|
"Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n"
|
12
|
-
"POT-Creation-Date: 2017-
|
13
|
-
"PO-Revision-Date: 2017-
|
12
|
+
"POT-Creation-Date: 2017-10-25 23:09+0000\n"
|
13
|
+
"PO-Revision-Date: 2017-10-25 23:09+0000\n"
|
14
14
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
15
15
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
16
16
|
"Language: \n"
|
@@ -23,15 +23,15 @@ msgstr ""
|
|
23
23
|
msgid "Puppet %{version} requires ruby 1.9.3 or greater."
|
24
24
|
msgstr ""
|
25
25
|
|
26
|
-
#: ../lib/puppet.rb:
|
26
|
+
#: ../lib/puppet.rb:133
|
27
27
|
msgid "Support for ruby version %{version} is deprecated and will be removed in a future release. See https://docs.puppet.com/puppet/latest/system_requirements.html#ruby for a list of supported ruby versions."
|
28
28
|
msgstr ""
|
29
29
|
|
30
|
-
#: ../lib/puppet.rb:
|
30
|
+
#: ../lib/puppet.rb:180
|
31
31
|
msgid "Creating %{name} via Puppet.newtype is deprecated and will be removed in a future release. Use Puppet::Type.newtype instead."
|
32
32
|
msgstr ""
|
33
33
|
|
34
|
-
#: ../lib/puppet.rb:
|
34
|
+
#: ../lib/puppet.rb:199
|
35
35
|
msgid "The environmentpath setting cannot be empty or nil."
|
36
36
|
msgstr ""
|
37
37
|
|
@@ -2065,43 +2065,47 @@ msgstr ""
|
|
2065
2065
|
msgid "Unable to find a common checksum type between agent '%{agent_type}' and master '%{master_type}'."
|
2066
2066
|
msgstr ""
|
2067
2067
|
|
2068
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2069
|
-
msgid "Compiled
|
2068
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:275
|
2069
|
+
msgid "Compiled static catalog for %{node} in environment %{environment}"
|
2070
2070
|
msgstr ""
|
2071
2071
|
|
2072
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2073
|
-
msgid "static catalog"
|
2072
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:277
|
2073
|
+
msgid "Compiled static catalog for %{node}"
|
2074
2074
|
msgstr ""
|
2075
2075
|
|
2076
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2077
|
-
msgid "catalog"
|
2076
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:281
|
2077
|
+
msgid "Compiled catalog for %{node} in environment %{environment}"
|
2078
2078
|
msgstr ""
|
2079
2079
|
|
2080
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2081
|
-
msgid "
|
2080
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:283
|
2081
|
+
msgid "Compiled catalog for %{node}"
|
2082
2082
|
msgstr ""
|
2083
2083
|
|
2084
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2084
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:302
|
2085
|
+
msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment}"
|
2086
|
+
msgstr ""
|
2087
|
+
|
2088
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:304
|
2085
2089
|
msgid "Inlined resource metadata into static catalog for %{node}"
|
2086
2090
|
msgstr ""
|
2087
2091
|
|
2088
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2092
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:321
|
2089
2093
|
msgid "Found node information"
|
2090
2094
|
msgstr ""
|
2091
2095
|
|
2092
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2096
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:329
|
2093
2097
|
msgid "Failed when searching for node %{name}: %{detail}"
|
2094
2098
|
msgstr ""
|
2095
2099
|
|
2096
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2100
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:348
|
2097
2101
|
msgid "Invalid option use_node for a remote request"
|
2098
2102
|
msgstr ""
|
2099
2103
|
|
2100
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2104
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:366
|
2101
2105
|
msgid "Could not find node '%{name}'; cannot compile"
|
2102
2106
|
msgstr ""
|
2103
2107
|
|
2104
|
-
#: ../lib/puppet/indirector/catalog/compiler.rb:
|
2108
|
+
#: ../lib/puppet/indirector/catalog/compiler.rb:384
|
2105
2109
|
msgid "Could not retrieve fact %{fact}"
|
2106
2110
|
msgstr ""
|
2107
2111
|
|
@@ -4977,7 +4981,7 @@ msgstr ""
|
|
4977
4981
|
msgid "Enumeration.enumerator is deprecated. Use Iterable.on instead"
|
4978
4982
|
msgstr ""
|
4979
4983
|
|
4980
|
-
#: ../lib/puppet/pops/types/p_binary_type.rb:
|
4984
|
+
#: ../lib/puppet/pops/types/p_binary_type.rb:77
|
4981
4985
|
msgid "The given string in encoding '%{enc}' is invalid. Cannot create a Binary UTF-8 representation"
|
4982
4986
|
msgstr ""
|
4983
4987
|
|
@@ -4993,7 +4997,7 @@ msgstr ""
|
|
4993
4997
|
msgid "The type '%{type}' does not represent a valid set of parameters for %{subject}.new()"
|
4994
4998
|
msgstr ""
|
4995
4999
|
|
4996
|
-
#: ../lib/puppet/pops/types/p_object_type.rb:
|
5000
|
+
#: ../lib/puppet/pops/types/p_object_type.rb:610
|
4997
5001
|
msgid "reference to unresolved type '%{name}'"
|
4998
5002
|
msgstr ""
|
4999
5003
|
|
@@ -7923,11 +7927,11 @@ msgstr ""
|
|
7923
7927
|
msgid "Failed to set file attributes"
|
7924
7928
|
msgstr ""
|
7925
7929
|
|
7926
|
-
#: ../lib/puppet/util/windows/file.rb:
|
7930
|
+
#: ../lib/puppet/util/windows/file.rb:207
|
7927
7931
|
msgid "out_buffer is required"
|
7928
7932
|
msgstr ""
|
7929
7933
|
|
7930
|
-
#: ../lib/puppet/util/windows/file.rb:
|
7934
|
+
#: ../lib/puppet/util/windows/file.rb:288
|
7931
7935
|
msgid "Failed to call GetLongPathName"
|
7932
7936
|
msgstr ""
|
7933
7937
|
|
@@ -43,12 +43,27 @@ describe Puppet::FileBucket::File do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "saving binary files" do
|
46
|
-
|
46
|
+
context "given multiple backups of identical files" do
|
47
|
+
it "does not error given content with binary external encoding" do
|
48
|
+
binary = "\xD1\xF2\r\n\x81NuSc\x00".force_encoding(Encoding::ASCII_8BIT)
|
49
|
+
bucket_file = Puppet::FileBucket::File.new(binary)
|
50
|
+
Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
|
51
|
+
Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
|
52
|
+
end
|
47
53
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
it "also does not error if the content is reported with UTF-8 external encoding" do
|
55
|
+
# PUP-7951 - ensure accurate size comparison across encodings If binary
|
56
|
+
# content arrives as a string with UTF-8 default external encoding, its
|
57
|
+
# character count might be different than the same bytes with binary
|
58
|
+
# external encoding. Ensure our equality comparison does not fail due to this.
|
59
|
+
# As would be the case with our friend snowman:
|
60
|
+
# Unicode snowman \u2603 - \xE2 \x98 \x83
|
61
|
+
# character size 1, if interpreted as UTF-8, 3 "characters" if interpreted as binary
|
62
|
+
utf8 = "\u2603".force_encoding(Encoding::UTF_8)
|
63
|
+
bucket_file = Puppet::FileBucket::File.new(utf8)
|
64
|
+
Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
|
65
|
+
Puppet::FileBucket::File.indirection.save(bucket_file, bucket_file.name)
|
66
|
+
end
|
52
67
|
end
|
53
68
|
end
|
54
69
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
|
+
require 'puppet_spec/compiler'
|
3
4
|
|
4
5
|
require 'puppet/transaction'
|
5
6
|
|
6
7
|
describe Puppet::Transaction do
|
7
8
|
include PuppetSpec::Files
|
9
|
+
include PuppetSpec::Compiler
|
8
10
|
|
9
11
|
before do
|
10
12
|
Puppet::Util::Storage.stubs(:store)
|
@@ -17,11 +19,11 @@ describe Puppet::Transaction do
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def touch_path
|
20
|
-
Puppet.features.microsoft_windows? ? "#{ENV['windir']}
|
22
|
+
Puppet.features.microsoft_windows? ? "#{ENV['windir']}\\system32" : "/usr/bin:/bin"
|
21
23
|
end
|
22
24
|
|
23
25
|
def usr_bin_touch(path)
|
24
|
-
Puppet.features.microsoft_windows? ? "#{ENV['windir']}
|
26
|
+
Puppet.features.microsoft_windows? ? "#{ENV['windir']}\\system32\\cmd.exe /c \"type NUL >> \"#{path}\"\"" : "/usr/bin/touch #{path}"
|
25
27
|
end
|
26
28
|
|
27
29
|
def touch(path)
|
@@ -338,6 +340,37 @@ describe Puppet::Transaction do
|
|
338
340
|
expect(Puppet::FileSystem.exist?(file2)).to be_truthy
|
339
341
|
end
|
340
342
|
end
|
343
|
+
|
344
|
+
it "should propagate events correctly from a tagged container when running with tags" do
|
345
|
+
file1 = tmpfile("original_tag")
|
346
|
+
file2 = tmpfile("tag_propagation")
|
347
|
+
command1 = usr_bin_touch(file1)
|
348
|
+
command2 = usr_bin_touch(file2)
|
349
|
+
manifest = <<-"MANIFEST"
|
350
|
+
class foo {
|
351
|
+
exec { 'notify test':
|
352
|
+
command => '#{command1}',
|
353
|
+
refreshonly => true,
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
class test {
|
358
|
+
include foo
|
359
|
+
|
360
|
+
exec { 'test':
|
361
|
+
command => '#{command2}',
|
362
|
+
notify => Class['foo'],
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
include test
|
367
|
+
MANIFEST
|
368
|
+
|
369
|
+
Puppet[:tags] = 'test'
|
370
|
+
apply_compiled_manifest(manifest)
|
371
|
+
expect(Puppet::FileSystem.exist?(file1)).to be_truthy
|
372
|
+
expect(Puppet::FileSystem.exist?(file2)).to be_truthy
|
373
|
+
end
|
341
374
|
end
|
342
375
|
|
343
376
|
describe "skipping resources" do
|
@@ -62,7 +62,7 @@ describe Puppet::Forge do
|
|
62
62
|
|
63
63
|
# ignores Puppet::Forge::Repository#read_response, provides response to fetch
|
64
64
|
performs_an_http_request(ok_response) do |http|
|
65
|
-
encoded_uri = "/v3/releases?module=#{module_name}&module_groups=base%20pe"
|
65
|
+
encoded_uri = "/v3/releases?module=#{module_name}&sort_by=version&module_groups=base%20pe"
|
66
66
|
http.expects(:request).with(responds_with(:path, encoded_uri))
|
67
67
|
end
|
68
68
|
|
@@ -74,7 +74,7 @@ describe Puppet::Forge do
|
|
74
74
|
|
75
75
|
# ignores Puppet::Forge::Repository#read_response, provides response to fetch
|
76
76
|
performs_an_http_request(ok_response) do |http|
|
77
|
-
encoded_uri = "/v3/releases?module=puppetlabs-#{mixed_utf8_query_param_encoded}"
|
77
|
+
encoded_uri = "/v3/releases?module=puppetlabs-#{mixed_utf8_query_param_encoded}&sort_by=version"
|
78
78
|
http.expects(:request).with(responds_with(:path, encoded_uri))
|
79
79
|
end
|
80
80
|
|
data/spec/unit/forge_spec.rb
CHANGED
@@ -131,6 +131,111 @@ describe Puppet::Forge do
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
# See PUP-8008
|
135
|
+
context "when multiple module_groups are defined" do
|
136
|
+
let(:release_response) do
|
137
|
+
releases = JSON.parse(http_response)
|
138
|
+
releases['results'] = []
|
139
|
+
JSON.dump(releases)
|
140
|
+
end
|
141
|
+
|
142
|
+
context "with space seperator" do
|
143
|
+
before :each do
|
144
|
+
repository_responds_with(stub(:body => release_response, :code => '200')).with {|uri| uri =~ /module_groups=foo bar/}
|
145
|
+
Puppet[:module_groups] = "foo bar"
|
146
|
+
end
|
147
|
+
|
148
|
+
it "passes module_groups with search" do
|
149
|
+
forge.search('bacula')
|
150
|
+
end
|
151
|
+
|
152
|
+
it "passes module_groups with fetch" do
|
153
|
+
forge.fetch('puppetlabs-bacula')
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
context "with plus seperator" do
|
158
|
+
before :each do
|
159
|
+
repository_responds_with(stub(:body => release_response, :code => '200')).with {|uri| uri =~ /module_groups=foo bar/}
|
160
|
+
Puppet[:module_groups] = "foo+bar"
|
161
|
+
end
|
162
|
+
|
163
|
+
it "passes module_groups with search" do
|
164
|
+
forge.search('bacula')
|
165
|
+
end
|
166
|
+
|
167
|
+
it "passes module_groups with fetch" do
|
168
|
+
forge.fetch('puppetlabs-bacula')
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# See PUP-8008
|
173
|
+
context "when there are multiple pages of results" do
|
174
|
+
before(:each) do
|
175
|
+
Puppet::Forge::Repository.any_instance.expects(:make_http_request).with {|uri| uri =~ /module_groups=foo bar/ && uri !=~ /offset/ }.returns(stub(:body => first_page, :code => '200'))
|
176
|
+
|
177
|
+
# Request for second page should not have module_groups already encoded
|
178
|
+
Puppet::Forge::Repository.any_instance.expects(:make_http_request).with {|uri| uri =~ /module_groups=foo bar/ && uri =~ /offset=1/ }.returns(stub(:body => last_page, :code => '200'))
|
179
|
+
end
|
180
|
+
|
181
|
+
context "with space seperator" do
|
182
|
+
before(:each) do
|
183
|
+
Puppet[:module_groups] = "foo bar"
|
184
|
+
end
|
185
|
+
|
186
|
+
let(:first_page) do
|
187
|
+
resp = JSON.parse(http_response)
|
188
|
+
resp['results'] = []
|
189
|
+
resp['pagination']['next'] = "/v3/modules?limit=1&offset=1&module_groups=foo%20bar"
|
190
|
+
JSON.dump(resp)
|
191
|
+
end
|
192
|
+
|
193
|
+
let(:last_page) do
|
194
|
+
resp = JSON.parse(http_response)
|
195
|
+
resp['results'] = []
|
196
|
+
resp['pagination']['current'] = "/v3/modules?limit=1&offset=1&module_groups=foo%20bar"
|
197
|
+
JSON.dump(resp)
|
198
|
+
end
|
199
|
+
|
200
|
+
it "traverses pages during search" do
|
201
|
+
forge.search('bacula')
|
202
|
+
end
|
203
|
+
|
204
|
+
it "traverses pages during fetch" do
|
205
|
+
forge.fetch('puppetlabs-bacula')
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context "with plus seperator" do
|
210
|
+
before(:each) do
|
211
|
+
Puppet[:module_groups] = "foo+bar"
|
212
|
+
end
|
213
|
+
|
214
|
+
let(:first_page) do
|
215
|
+
resp = JSON.parse(http_response)
|
216
|
+
resp['results'] = []
|
217
|
+
resp['pagination']['next'] = "/v3/modules?limit=1&offset=1&module_groups=foo+bar"
|
218
|
+
JSON.dump(resp)
|
219
|
+
end
|
220
|
+
|
221
|
+
let(:last_page) do
|
222
|
+
resp = JSON.parse(http_response)
|
223
|
+
resp['results'] = []
|
224
|
+
resp['pagination']['current'] = "/v3/modules?limit=1&offset=1&module_groups=foo+bar"
|
225
|
+
JSON.dump(resp)
|
226
|
+
end
|
227
|
+
|
228
|
+
it "traverses pages during search" do
|
229
|
+
forge.search('bacula')
|
230
|
+
end
|
231
|
+
|
232
|
+
it "traverses pages during fetch" do
|
233
|
+
forge.fetch('puppetlabs-bacula')
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
134
239
|
context "when the connection to the forge fails" do
|
135
240
|
before :each do
|
136
241
|
repository_responds_with(stub(:body => '{}', :code => '404', :message => "not found"))
|
@@ -35,22 +35,22 @@ describe Puppet::GettextConfig do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe '
|
38
|
+
describe 'loading translations' do
|
39
39
|
context 'when given a nil config path' do
|
40
40
|
it 'should return false' do
|
41
|
-
expect(Puppet::GettextConfig.
|
41
|
+
expect(Puppet::GettextConfig.load_translations('puppet', nil, :po)).to be false
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'when given a valid config file location' do
|
46
46
|
it 'should return true' do
|
47
|
-
expect(Puppet::GettextConfig.
|
47
|
+
expect(Puppet::GettextConfig.load_translations('puppet', local_path, :po)).to be true
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when given a bad file format' do
|
52
52
|
it 'should raise an exception' do
|
53
|
-
expect { Puppet::GettextConfig.
|
53
|
+
expect { Puppet::GettextConfig.load_translations('puppet', local_path, :bad_format) }.to raise_error(Puppet::Error)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -295,6 +295,21 @@ describe Puppet::Graph::RelationshipGraph do
|
|
295
295
|
completed_sentinel_of("class[A]"))
|
296
296
|
end
|
297
297
|
|
298
|
+
it "admissible and completed sentinels should inherit the same tags" do
|
299
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
300
|
+
class a {
|
301
|
+
tag "test_tag"
|
302
|
+
}
|
303
|
+
|
304
|
+
include a
|
305
|
+
MANIFEST
|
306
|
+
|
307
|
+
expect(vertex_called(relationship_graph, admissible_sentinel_of("class[A]")).tagged?("test_tag")).
|
308
|
+
to eq(true)
|
309
|
+
expect(vertex_called(relationship_graph, completed_sentinel_of("class[A]")).tagged?("test_tag")).
|
310
|
+
to eq(true)
|
311
|
+
end
|
312
|
+
|
298
313
|
it "should remove all Component objects from the dependency graph" do
|
299
314
|
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
300
315
|
class a {
|
data/spec/unit/module_spec.rb
CHANGED
@@ -225,10 +225,10 @@ describe Puppet::Module do
|
|
225
225
|
mod_dir = "#{@modpath}/#{mod_name}"
|
226
226
|
metadata_file = "#{mod_dir}/metadata.json"
|
227
227
|
tasks_dir = "#{mod_dir}/tasks"
|
228
|
-
|
228
|
+
locale_dir = "#{mod_dir}/locales"
|
229
229
|
Puppet::FileSystem.stubs(:exist?).with(metadata_file).returns true
|
230
230
|
# Skip checking for translation config file
|
231
|
-
Puppet::FileSystem.stubs(:exist?).with(
|
231
|
+
Puppet::FileSystem.stubs(:exist?).with(locale_dir).returns false
|
232
232
|
end
|
233
233
|
mod = PuppetSpec::Modules.create(
|
234
234
|
'test_gte_req',
|
@@ -449,28 +449,22 @@ describe Puppet::Module do
|
|
449
449
|
describe "initialize_i18n" do
|
450
450
|
|
451
451
|
let(:modpath) { tmpdir('modpath') }
|
452
|
-
let(:modname) { '
|
452
|
+
let(:modname) { 'i18n' }
|
453
453
|
let(:modroot) { "#{modpath}/#{modname}/" }
|
454
454
|
let(:locale_dir) { "#{modroot}locales" }
|
455
|
-
let(:config_path) { "#{locale_dir}/config.yaml" }
|
456
455
|
let(:mod_obj) { PuppetSpec::Modules.create( modname, modpath, :metadata => { :dependencies => [] }, :env => env ) }
|
457
456
|
|
458
457
|
it "is expected to initialize an un-initialized module" do
|
459
|
-
expect(
|
458
|
+
expect(Puppet::GettextConfig.translations_loaded?("puppetlabs-#{modname}")).to be false
|
460
459
|
|
461
460
|
FileUtils.mkdir_p(locale_dir)
|
462
|
-
|
463
|
-
"gettext" => {
|
464
|
-
"project_name" => modname
|
465
|
-
}
|
466
|
-
}
|
467
|
-
File.open(config_path, 'w') { |file| file.write(config.to_yaml) }
|
468
|
-
Puppet::FileSystem.stubs(:exist?).with(config_path).returns(true)
|
461
|
+
Puppet::FileSystem.stubs(:exist?).with(locale_dir).returns(true)
|
469
462
|
|
470
463
|
mod_obj.initialize_i18n
|
471
464
|
|
472
|
-
expect(
|
465
|
+
expect(Puppet::GettextConfig.translations_loaded?("puppetlabs-#{modname}")).to be true
|
473
466
|
end
|
467
|
+
|
474
468
|
it "is expected return nil if module is intiailized" do
|
475
469
|
expect(mod_obj.initialize_i18n).to be nil
|
476
470
|
end
|
@@ -618,6 +612,7 @@ describe Puppet::Module do
|
|
618
612
|
|
619
613
|
it "after the module is initialized" do
|
620
614
|
Puppet::FileSystem.expects(:exist?).with(mod_tasks_dir).never
|
615
|
+
Puppet::GettextConfig.expects(:load_translations).returns(false)
|
621
616
|
Puppet::Module::Task.expects(:tasks_in_module).never
|
622
617
|
Puppet::Module.new(mod_name, @modpath, env)
|
623
618
|
end
|