puppet 6.0.0-universal-darwin → 6.0.1-universal-darwin
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 +4 -4
- data/Gemfile.lock +4 -4
- data/lib/puppet/application/apply.rb +99 -59
- data/lib/puppet/application/cert.rb +2 -112
- data/lib/puppet/configurer.rb +2 -3
- data/lib/puppet/defaults.rb +14 -1
- data/lib/puppet/etc.rb +20 -0
- data/lib/puppet/module/task.rb +29 -38
- data/lib/puppet/parser/catalog_compiler.rb +24 -0
- data/lib/puppet/parser/compiler.rb +3 -1
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +3 -0
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +18 -10
- data/lib/puppet/pops/loader/task_instantiator.rb +13 -70
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
- data/lib/puppet/pops/parser/lexer2.rb +1 -1
- data/lib/puppet/pops/pcore.rb +10 -33
- data/lib/puppet/pops/serialization.rb +1 -0
- data/lib/puppet/pops/serialization/to_data_converter.rb +9 -1
- data/lib/puppet/provider/exec.rb +57 -57
- data/lib/puppet/provider/group/aix.rb +1 -15
- data/lib/puppet/provider/group/pw.rb +4 -8
- data/lib/puppet/provider/group/windows_adsi.rb +7 -4
- data/lib/puppet/provider/nameservice.rb +1 -25
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -3
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/service/launchd.rb +19 -3
- data/lib/puppet/provider/user/aix.rb +48 -2
- data/lib/puppet/type/group.rb +62 -18
- data/lib/puppet/type/schedule.rb +7 -0
- data/lib/puppet/util/execution.rb +14 -1
- data/lib/puppet/util/posix.rb +15 -0
- data/lib/puppet/util/storage.rb +12 -0
- data/lib/puppet/util/windows/adsi.rb +60 -1
- data/lib/puppet/util/windows/process.rb +16 -1
- data/lib/puppet/util/windows/service.rb +68 -26
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_pal.rb +36 -3
- data/locales/ja/puppet.po +598 -861
- data/locales/puppet.pot +197 -160
- data/man/man5/puppet.conf.5 +12 -1
- data/man/man8/puppet.8 +1 -1
- data/spec/integration/application/apply_spec.rb +4 -1
- data/spec/integration/util/windows/adsi_spec.rb +2 -1
- data/spec/unit/application/apply_spec.rb +14 -0
- data/spec/unit/configurer_spec.rb +11 -0
- data/spec/unit/etc_spec.rb +25 -0
- data/spec/unit/indirector/catalog/json_spec.rb +9 -3
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +22 -4
- data/spec/unit/pops/loaders/loader_spec.rb +3 -10
- data/spec/unit/pops/loaders/loaders_spec.rb +30 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +7 -7
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +16 -0
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +9 -0
- data/spec/unit/pops/types/task_spec.rb +42 -116
- data/spec/unit/provider/group/aix_spec.rb +0 -19
- data/spec/unit/provider/group/pw_spec.rb +0 -6
- data/spec/unit/provider/group/windows_adsi_spec.rb +34 -35
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
- data/spec/unit/provider/service/launchd_spec.rb +19 -0
- data/spec/unit/provider/user/aix_spec.rb +43 -2
- data/spec/unit/provider/user/windows_adsi_spec.rb +1 -4
- data/spec/unit/puppet_pal_2pec.rb +6 -6
- data/spec/unit/puppet_pal_catalog_spec.rb +58 -0
- data/spec/unit/task_spec.rb +50 -5
- data/spec/unit/type/group_spec.rb +111 -13
- data/spec/unit/util/execution_spec.rb +59 -0
- data/spec/unit/util/posix_spec.rb +28 -0
- data/spec/unit/util/storage_spec.rb +107 -0
- data/spec/unit/util/windows/adsi_spec.rb +100 -5
- data/spec/unit/util/windows/service_spec.rb +100 -43
- metadata +2 -2
data/spec/unit/task_spec.rb
CHANGED
@@ -68,8 +68,7 @@ describe Puppet::Module::Task do
|
|
68
68
|
task_files = %w{task1.elf task1.sh task1.json}.map { |bn| "#{tasks_path}/#{bn}" }
|
69
69
|
Dir.expects(:glob).with(tasks_glob).returns(task_files)
|
70
70
|
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
71
|
-
Puppet::Module::Task.any_instance.stubs(:metadata).returns({'implementations' =>
|
72
|
-
[{"name" => "task1.sh"}]})
|
71
|
+
Puppet::Module::Task.any_instance.stubs(:metadata).returns({'implementations' => [{"name" => "task1.sh"}]})
|
73
72
|
|
74
73
|
expect(tasks.count).to eq(1)
|
75
74
|
expect(tasks.map{|t| t.name}).to eq(%w{mymod::task1})
|
@@ -77,6 +76,52 @@ describe Puppet::Module::Task do
|
|
77
76
|
expect(tasks.map{|t| t.files.map{ |f| f["path"] } }).to eq([["#{tasks_path}/task1.sh"]])
|
78
77
|
end
|
79
78
|
|
79
|
+
it "constructs a task as expected when task metadata declares additional files" do
|
80
|
+
task_files = %w{task1.sh task1.json}.map { |bn| "#{tasks_path}/#{bn}" }
|
81
|
+
Dir.expects(:glob).with(tasks_glob).returns(task_files)
|
82
|
+
Puppet::Module::Task.expects(:find_extra_files).returns([{'name' => 'mymod/lib/file0.elf', 'path' => "/path/to/file0.elf"}])
|
83
|
+
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
84
|
+
Puppet::Module::Task.any_instance.stubs(:metadata).returns({'files' => ["mymod/lib/file0.elf"]})
|
85
|
+
|
86
|
+
expect(tasks.count).to eq(1)
|
87
|
+
expect(tasks.map{|t| t.name}).to eq(%w{mymod::task1})
|
88
|
+
expect(tasks.map{|t| t.metadata_file}).to eq(["#{tasks_path}/task1.json"])
|
89
|
+
expect(tasks.map{|t| t.files.map{ |f| f["path"] } }).to eq([["#{tasks_path}/task1.sh", "/path/to/file0.elf"]])
|
90
|
+
end
|
91
|
+
|
92
|
+
it "constructs a task as expected when a task implementation declares additional files" do
|
93
|
+
task_files = %w{task1.sh task1.json}.map { |bn| "#{tasks_path}/#{bn}" }
|
94
|
+
Dir.expects(:glob).with(tasks_glob).returns(task_files)
|
95
|
+
Puppet::Module::Task.expects(:find_extra_files).returns([{'name' => 'mymod/lib/file0.elf', 'path' => "/path/to/file0.elf"}])
|
96
|
+
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
97
|
+
Puppet::Module::Task.any_instance.stubs(:metadata).returns({'implementations' => [{"name" => "task1.sh", "files" => ["mymod/lib/file0.elf"]}]})
|
98
|
+
|
99
|
+
expect(tasks.count).to eq(1)
|
100
|
+
expect(tasks.map{|t| t.name}).to eq(%w{mymod::task1})
|
101
|
+
expect(tasks.map{|t| t.metadata_file}).to eq(["#{tasks_path}/task1.json"])
|
102
|
+
expect(tasks.map{|t| t.files.map{ |f| f["path"] } }).to eq([["#{tasks_path}/task1.sh", "/path/to/file0.elf"]])
|
103
|
+
end
|
104
|
+
|
105
|
+
it "constructs a task as expected when task metadata and a task implementation both declare additional files" do
|
106
|
+
task_files = %w{task1.sh task1.json}.map { |bn| "#{tasks_path}/#{bn}" }
|
107
|
+
Dir.expects(:glob).with(tasks_glob).returns(task_files)
|
108
|
+
Puppet::Module::Task.expects(:find_extra_files).returns([
|
109
|
+
{'name' => 'mymod/lib/file0.elf', 'path' => "/path/to/file0.elf"},
|
110
|
+
{'name' => 'yourmod/files/file1.txt', 'path' => "/other/path/to/file1.txt"}
|
111
|
+
])
|
112
|
+
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
113
|
+
Puppet::Module::Task.any_instance.stubs(:metadata).returns({'implementations' => [{"name" => "task1.sh", "files" => ["mymod/lib/file0.elf"]}]})
|
114
|
+
|
115
|
+
expect(tasks.count).to eq(1)
|
116
|
+
expect(tasks.map{|t| t.name}).to eq(%w{mymod::task1})
|
117
|
+
expect(tasks.map{|t| t.metadata_file}).to eq(["#{tasks_path}/task1.json"])
|
118
|
+
expect(tasks.map{|t| t.files.map{ |f| f["path"] } }).to eq([[
|
119
|
+
"#{tasks_path}/task1.sh",
|
120
|
+
"/path/to/file0.elf",
|
121
|
+
"/other/path/to/file1.txt"
|
122
|
+
]])
|
123
|
+
end
|
124
|
+
|
80
125
|
it "constructs a task as expected when a task has files" do
|
81
126
|
og_files = %w{task1.sh task1.json}.map { |bn| "#{tasks_path}/#{bn}" }
|
82
127
|
Dir.expects(:glob).with(tasks_glob).returns(og_files)
|
@@ -136,7 +181,7 @@ describe Puppet::Module::Task do
|
|
136
181
|
it "loads metadata for a task" do
|
137
182
|
metadata = {'desciption': 'some info'}
|
138
183
|
Dir.expects(:glob).with(tasks_glob).returns(%w{task1.exe task1.json})
|
139
|
-
Puppet::Module::Task.
|
184
|
+
Puppet::Module::Task.stubs(:read_metadata).returns(metadata)
|
140
185
|
|
141
186
|
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
142
187
|
|
@@ -180,7 +225,7 @@ describe Puppet::Module::Task do
|
|
180
225
|
metadata = {'desciption' => 'some info',
|
181
226
|
'implementations' => [ {"name" => "task1.exe"}, ] }
|
182
227
|
Dir.expects(:glob).with(tasks_glob).returns(%w{task1.exe task1.sh task1.json})
|
183
|
-
Puppet::Module::Task.
|
228
|
+
Puppet::Module::Task.stubs(:read_metadata).returns(metadata)
|
184
229
|
|
185
230
|
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
186
231
|
|
@@ -192,7 +237,7 @@ describe Puppet::Module::Task do
|
|
192
237
|
metadata = {'desciption' => 'some info',
|
193
238
|
'implementations' => [ {"name" => "task2.sh"}, ] }
|
194
239
|
Dir.expects(:glob).with(tasks_glob).returns(%w{task1.exe task2.sh task1.json})
|
195
|
-
Puppet::Module::Task.
|
240
|
+
Puppet::Module::Task.stubs(:read_metadata).returns(metadata)
|
196
241
|
|
197
242
|
tasks = Puppet::Module::Task.tasks_in_module(mymod)
|
198
243
|
|
@@ -2,8 +2,21 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Puppet::Type.type(:group) do
|
5
|
-
|
5
|
+
let(:mock_group_provider) do
|
6
|
+
described_class.provide(:mock_group_provider) do
|
7
|
+
has_features :manages_members
|
8
|
+
mk_resource_methods
|
9
|
+
def create; end
|
10
|
+
def delete; end
|
11
|
+
def exists?; get(:ensure) != :absent; end
|
12
|
+
def flush; end
|
13
|
+
def self.instances; []; end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
6
18
|
@class = Puppet::Type.type(:group)
|
19
|
+
described_class.stubs(:defaultprovider).returns mock_group_provider
|
7
20
|
end
|
8
21
|
|
9
22
|
it "should have a system_groups feature" do
|
@@ -70,23 +83,108 @@ describe Puppet::Type.type(:group) do
|
|
70
83
|
expect(type.exists?).to eq(true)
|
71
84
|
end
|
72
85
|
|
73
|
-
describe "
|
86
|
+
describe "when managing members" do
|
87
|
+
def stub_property(resource_hash)
|
88
|
+
described_class.new(resource_hash).property(:members)
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "validation" do
|
92
|
+
it "raises an error for a non-String value" do
|
93
|
+
expect {
|
94
|
+
described_class.new(:name => 'foo', :members => true)
|
95
|
+
}.to raise_error(Puppet::Error)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "raises an error for an array value containing a non-String element" do
|
99
|
+
expect {
|
100
|
+
described_class.new(:name => 'foo', :members => [ true, 'foo' ])
|
101
|
+
}.to raise_error(Puppet::Error)
|
102
|
+
end
|
103
|
+
|
104
|
+
it "raises an error when the members are specified as UIDs instead of usernames" do
|
105
|
+
expect {
|
106
|
+
described_class.new(:name => 'foo', :members => [ '123', '456' ])
|
107
|
+
}.to raise_error(Puppet::Error)
|
108
|
+
end
|
109
|
+
|
110
|
+
it "raises an error when an empty string is passed for a member's username" do
|
111
|
+
expect {
|
112
|
+
described_class.new(:name => 'foo', :members => [ 'foo', '' ])
|
113
|
+
}.to raise_error(Puppet::Error)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "passes for a single member" do
|
117
|
+
expect {
|
118
|
+
described_class.new(:name => 'foo', :members => 'foo')
|
119
|
+
}.to_not raise_error
|
120
|
+
end
|
121
|
+
|
122
|
+
it "passes for a member whose username has a number" do
|
123
|
+
expect {
|
124
|
+
described_class.new(:name => 'foo', :members => 'foo123')
|
125
|
+
}.to_not raise_error
|
126
|
+
end
|
127
|
+
|
128
|
+
it "passes for an array of members" do
|
129
|
+
expect {
|
130
|
+
described_class.new(:name => 'foo', :members => [ 'foo', 'bar' ])
|
131
|
+
}.to_not raise_error
|
132
|
+
end
|
74
133
|
|
75
|
-
|
76
|
-
|
77
|
-
|
134
|
+
it "passes for a comma-separated list of members" do
|
135
|
+
expect {
|
136
|
+
described_class.new(:name => 'foo', :members => 'foo,bar')
|
137
|
+
}.to_not raise_error
|
138
|
+
end
|
139
|
+
end
|
78
140
|
|
79
|
-
|
80
|
-
|
81
|
-
|
141
|
+
describe "#inclusive?" do
|
142
|
+
it "returns false when auth_membership == false" do
|
143
|
+
members_property = stub_property(
|
144
|
+
:name => 'foo',
|
145
|
+
:auth_membership => false,
|
146
|
+
:members => []
|
147
|
+
)
|
148
|
+
|
149
|
+
expect(members_property.inclusive?).to be false
|
150
|
+
end
|
151
|
+
|
152
|
+
it "returns true when auth_membership == true" do
|
153
|
+
members_property = stub_property(
|
154
|
+
:name => 'foo',
|
155
|
+
:auth_membership => true,
|
156
|
+
:members => []
|
157
|
+
)
|
158
|
+
|
159
|
+
expect(members_property.inclusive?).to be true
|
160
|
+
end
|
82
161
|
end
|
83
162
|
|
84
|
-
|
85
|
-
|
86
|
-
|
163
|
+
describe "#should= munging the @should instance variable" do
|
164
|
+
def should_var_of(property)
|
165
|
+
property.instance_variable_get(:@should)
|
166
|
+
end
|
87
167
|
|
88
|
-
|
89
|
-
|
168
|
+
it "leaves a single member as-is" do
|
169
|
+
members_property = stub_property(:name => 'foo', :members => [])
|
170
|
+
members_property.should = 'foo'
|
171
|
+
|
172
|
+
expect(should_var_of(members_property)).to eql([ 'foo' ])
|
173
|
+
end
|
174
|
+
|
175
|
+
it "leaves an array of members as-is" do
|
176
|
+
members_property = stub_property(:name => 'foo', :members => [])
|
177
|
+
members_property.should = [ 'foo', 'bar' ]
|
178
|
+
|
179
|
+
expect(should_var_of(members_property)).to eql(['foo', 'bar'])
|
180
|
+
end
|
181
|
+
|
182
|
+
it "munges a comma-separated list of members into an array" do
|
183
|
+
members_property = stub_property(:name => 'foo', :members => [])
|
184
|
+
members_property.should = 'foo,bar'
|
185
|
+
|
186
|
+
expect(should_var_of(members_property)).to eql(['foo', 'bar'])
|
187
|
+
end
|
90
188
|
end
|
91
189
|
end
|
92
190
|
end
|
@@ -119,6 +119,17 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
|
|
119
119
|
call_exec_posix("/bin/echo 'foo' ; \n /bin/echo 'bar' ;", {:uid => 50, :gid => 55}, @stdin, @stdout, @stderr)
|
120
120
|
end
|
121
121
|
|
122
|
+
context 'cwd option' do
|
123
|
+
let(:cwd) { 'cwd' }
|
124
|
+
|
125
|
+
it 'should run the command in the specified working directory' do
|
126
|
+
Dir.expects(:chdir).with(cwd)
|
127
|
+
Kernel.expects(:exec).with('test command')
|
128
|
+
|
129
|
+
call_exec_posix('test command', { :cwd => cwd }, @stdin, @stdout, @stderr)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
122
133
|
it "should return the pid of the child process" do
|
123
134
|
expect(call_exec_posix('test command', {}, @stdin, @stdout, @stderr)).to eq(pid)
|
124
135
|
end
|
@@ -144,6 +155,24 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
|
|
144
155
|
call_exec_windows('test command', {}, @stdin, @stdout, @stderr)
|
145
156
|
end
|
146
157
|
|
158
|
+
context 'cwd option' do
|
159
|
+
let(:cwd) { 'cwd' }
|
160
|
+
it "should execute the command in the specified working directory" do
|
161
|
+
Dir.expects(:chdir).with(cwd).yields
|
162
|
+
Process.expects(:create).with(
|
163
|
+
:command_line => "test command",
|
164
|
+
:startup_info => {
|
165
|
+
:stdin => @stdin,
|
166
|
+
:stdout => @stdout,
|
167
|
+
:stderr => @stderr
|
168
|
+
},
|
169
|
+
:close_handles => false
|
170
|
+
)
|
171
|
+
|
172
|
+
call_exec_windows('test command', { :cwd => cwd }, @stdin, @stdout, @stderr)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
147
176
|
it "should return the process info of the child process" do
|
148
177
|
expect(call_exec_windows('test command', {}, @stdin, @stdout, @stderr)).to eq(proc_info_stub)
|
149
178
|
end
|
@@ -219,6 +248,36 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
|
|
219
248
|
end
|
220
249
|
end
|
221
250
|
|
251
|
+
describe "cwd option" do
|
252
|
+
def expect_cwd_to_be(cwd)
|
253
|
+
Puppet::Util::Execution.expects(executor).with(
|
254
|
+
anything,
|
255
|
+
has_entries(:cwd => cwd),
|
256
|
+
anything,
|
257
|
+
anything,
|
258
|
+
anything
|
259
|
+
).returns(rval)
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'should raise an ArgumentError if the specified working directory does not exist' do
|
263
|
+
cwd = 'cwd'
|
264
|
+
Puppet::FileSystem.stubs(:directory?).with(cwd).returns(false)
|
265
|
+
|
266
|
+
expect {
|
267
|
+
Puppet::Util::Execution.execute('test command', cwd: cwd)
|
268
|
+
}.to raise_error do |error|
|
269
|
+
expect(error).to be_a(ArgumentError)
|
270
|
+
expect(error.message).to match(cwd)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should set the cwd to the user-specified one" do
|
275
|
+
Puppet::FileSystem.stubs(:directory?).with('cwd').returns(true)
|
276
|
+
expect_cwd_to_be('cwd')
|
277
|
+
Puppet::Util::Execution.execute('test command', cwd: 'cwd')
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
222
281
|
describe "on POSIX", :if => Puppet.features.posix? do
|
223
282
|
describe "when squelch is not set" do
|
224
283
|
it "should set stdout to a pipe" do
|
@@ -12,6 +12,34 @@ describe Puppet::Util::POSIX do
|
|
12
12
|
@posix = PosixTest.new
|
13
13
|
end
|
14
14
|
|
15
|
+
describe '.groups_of' do
|
16
|
+
let(:mock_groups) do
|
17
|
+
[
|
18
|
+
['group1', ['user1', 'user2']],
|
19
|
+
['group2', ['user2']],
|
20
|
+
['group1', ['user1', 'user2']],
|
21
|
+
['group3', ['user1']],
|
22
|
+
['group4', ['user2']]
|
23
|
+
].map do |(name, members)|
|
24
|
+
group_struct = stub("Group #{name}")
|
25
|
+
group_struct.stubs(:name).returns(name)
|
26
|
+
group_struct.stubs(:mem).returns(members)
|
27
|
+
|
28
|
+
group_struct
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
Puppet::Etc.stubs(:group).multiple_yields(*mock_groups)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns the groups of the given user' do
|
37
|
+
expect(Puppet::Util::POSIX.groups_of('user1')).to eql(
|
38
|
+
['group1', 'group3']
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
15
43
|
[:group, :gr].each do |name|
|
16
44
|
it "should return :gid as the field for #{name}" do
|
17
45
|
expect(@posix.idfield(name)).to eq(:gid)
|
@@ -225,5 +225,112 @@ describe Puppet::Util::Storage do
|
|
225
225
|
|
226
226
|
expect(Puppet::Util::Storage.state).to eq({:yayness=>{}})
|
227
227
|
end
|
228
|
+
|
229
|
+
it "expires entries with a :checked older than statettl seconds ago" do
|
230
|
+
Puppet[:statettl] = '1d'
|
231
|
+
recent_checked = Time.now
|
232
|
+
stale_checked = Time.now - (Puppet[:statettl] + 1)
|
233
|
+
Puppet::Util::Storage.cache(:yayness)[:checked] = recent_checked
|
234
|
+
Puppet::Util::Storage.cache(:stale)[:checked] = stale_checked
|
235
|
+
expect(Puppet::Util::Storage.state).to eq(
|
236
|
+
{
|
237
|
+
:yayness => {
|
238
|
+
:checked => recent_checked
|
239
|
+
},
|
240
|
+
:stale => {
|
241
|
+
:checked => stale_checked
|
242
|
+
}
|
243
|
+
}
|
244
|
+
)
|
245
|
+
|
246
|
+
Puppet::Util::Storage.store
|
247
|
+
Puppet::Util::Storage.clear
|
248
|
+
|
249
|
+
expect(Puppet::Util::Storage.state).to eq({})
|
250
|
+
|
251
|
+
Puppet::Util::Storage.load
|
252
|
+
|
253
|
+
expect(Puppet::Util::Storage.state).to eq(
|
254
|
+
{
|
255
|
+
:yayness => {
|
256
|
+
:checked => recent_checked
|
257
|
+
}
|
258
|
+
}
|
259
|
+
)
|
260
|
+
end
|
261
|
+
|
262
|
+
|
263
|
+
it "does not expire entries when statettl is 0" do
|
264
|
+
Puppet[:statettl] = '0'
|
265
|
+
recent_checked = Time.now
|
266
|
+
older_checked = Time.now - 10_000_000
|
267
|
+
Puppet::Util::Storage.cache(:yayness)[:checked] = recent_checked
|
268
|
+
Puppet::Util::Storage.cache(:older)[:checked] = older_checked
|
269
|
+
expect(Puppet::Util::Storage.state).to eq(
|
270
|
+
{
|
271
|
+
:yayness => {
|
272
|
+
:checked => recent_checked
|
273
|
+
},
|
274
|
+
:older => {
|
275
|
+
:checked => older_checked
|
276
|
+
}
|
277
|
+
}
|
278
|
+
)
|
279
|
+
|
280
|
+
Puppet::Util::Storage.store
|
281
|
+
Puppet::Util::Storage.clear
|
282
|
+
|
283
|
+
expect(Puppet::Util::Storage.state).to eq({})
|
284
|
+
|
285
|
+
Puppet::Util::Storage.load
|
286
|
+
|
287
|
+
expect(Puppet::Util::Storage.state).to eq(
|
288
|
+
{
|
289
|
+
:yayness => {
|
290
|
+
:checked => recent_checked
|
291
|
+
},
|
292
|
+
:older => {
|
293
|
+
:checked => older_checked
|
294
|
+
}
|
295
|
+
}
|
296
|
+
)
|
297
|
+
end
|
298
|
+
|
299
|
+
|
300
|
+
it "does not expire entries when statettl is 'unlimited'" do
|
301
|
+
Puppet[:statettl] = 'unlimited'
|
302
|
+
recent_checked = Time.now
|
303
|
+
older_checked = Time.now - 10_000_000
|
304
|
+
Puppet::Util::Storage.cache(:yayness)[:checked] = recent_checked
|
305
|
+
Puppet::Util::Storage.cache(:older)[:checked] = older_checked
|
306
|
+
expect(Puppet::Util::Storage.state).to eq(
|
307
|
+
{
|
308
|
+
:yayness => {
|
309
|
+
:checked => recent_checked
|
310
|
+
},
|
311
|
+
:older => {
|
312
|
+
:checked => older_checked
|
313
|
+
}
|
314
|
+
}
|
315
|
+
)
|
316
|
+
|
317
|
+
Puppet::Util::Storage.store
|
318
|
+
Puppet::Util::Storage.clear
|
319
|
+
|
320
|
+
expect(Puppet::Util::Storage.state).to eq({})
|
321
|
+
|
322
|
+
Puppet::Util::Storage.load
|
323
|
+
|
324
|
+
expect(Puppet::Util::Storage.state).to eq(
|
325
|
+
{
|
326
|
+
:yayness => {
|
327
|
+
:checked => recent_checked
|
328
|
+
},
|
329
|
+
:older => {
|
330
|
+
:checked => older_checked
|
331
|
+
}
|
332
|
+
}
|
333
|
+
)
|
334
|
+
end
|
228
335
|
end
|
229
336
|
end
|