File tree 2 files changed +28
-7
lines changed
2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -592,13 +592,17 @@ def check(value)
592
592
cmd = self [ :command ]
593
593
cmd = cmd [ 0 ] if cmd . is_a? Array
594
594
595
- cmd . scan ( file_regex ) { |str |
596
- reqs << str
597
- }
595
+ if cmd . is_a? ( Puppet ::Pops ::Evaluator ::DeferredValue )
596
+ self . debug ( "The 'command' parameter is deferred and cannot be autorequired" )
597
+ else
598
+ cmd . scan ( file_regex ) { |str |
599
+ reqs << str
600
+ }
598
601
599
- cmd . scan ( /^"([^"]+)"/ ) { |str |
600
- reqs << str
601
- }
602
+ cmd . scan ( /^"([^"]+)"/ ) { |str |
603
+ reqs << str
604
+ }
605
+ end
602
606
603
607
[ :onlyif , :unless ] . each { |param |
604
608
tmp = self [ param ]
@@ -613,7 +617,11 @@ def check(value)
613
617
# unqualified files, but, well, that's a bit more annoying
614
618
# to do.
615
619
line = line [ 0 ] if line . is_a? Array
616
- reqs += line . scan ( file_regex )
620
+ if line . is_a? ( Puppet ::Pops ::Evaluator ::DeferredValue )
621
+ self . debug ( "The '#{ param } ' parameter is deferred and cannot be autorequired" )
622
+ else
623
+ reqs += line . scan ( file_regex )
624
+ end
617
625
end
618
626
}
619
627
Original file line number Diff line number Diff line change @@ -252,6 +252,19 @@ def exec_stub(options = {})
252
252
expect ( dependencies . collect ( &:to_s ) ) . to eq ( [ Puppet ::Relationship . new ( tmp , execer ) . to_s ] )
253
253
end
254
254
255
+ it "skips autorequire for deferred commands" do
256
+ foo = make_absolute ( '/bin/foo' )
257
+ catalog = Puppet ::Resource ::Catalog . new
258
+ tmp = Puppet ::Type . type ( :file ) . new ( :name => foo )
259
+ execer = Puppet ::Type . type ( :exec ) . new ( :name => 'test array' , :command => Puppet ::Pops ::Evaluator ::DeferredValue . new ( nil ) )
260
+
261
+ catalog . add_resource tmp
262
+ catalog . add_resource execer
263
+ dependencies = execer . autorequire ( catalog )
264
+
265
+ expect ( dependencies . collect ( &:to_s ) ) . to eq ( [ ] )
266
+ end
267
+
255
268
describe "when handling the path parameter" do
256
269
expect = %w{ one two three four }
257
270
{ "an array" => expect ,
You can’t perform that action at this time.
0 commit comments