Skip to content

Commit f939846

Browse files
committed
(PUP-11526) Evaluate deferred functions lazily by default
This commit changes the default value of preprocess_deferred setting from true to false. This change will ensure deferred functions are not preprocessed by default and are instead evaluated during catalog application. Additionally, some tests were updated to accommodate this change. This work is a follow up to PUP-9323.
1 parent 5c115dc commit f939846

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

lib/puppet/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ def self.initialize_default_settings!(settings)
20372037
what is being done.",
20382038
},
20392039
:preprocess_deferred => {
2040-
:default => true,
2040+
:default => false,
20412041
:type => :boolean,
20422042
:desc => "Whether puppet should call deferred functions before applying
20432043
the catalog. If set to `true`, then all prerequisites needed for the

spec/integration/application/agent_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@
155155
end
156156

157157
it "fails to apply a deferred function with an unsatified prerequisite" do
158+
Puppet[:preprocess_deferred] = true
159+
158160
catalog_handler = -> (req, res) {
159161
catalog = compile_to_catalog(deferred_manifest, node)
160162
res.body = formatter.render(catalog)
@@ -173,8 +175,6 @@
173175
end
174176

175177
it "applies a deferred function and its prerequisite in the same run" do
176-
Puppet[:preprocess_deferred] = false
177-
178178
catalog_handler = -> (req, res) {
179179
catalog = compile_to_catalog(deferred_manifest, node)
180180
res.body = formatter.render(catalog)

spec/integration/application/apply_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ def bogus()
695695
end
696696

697697
it "fails to apply a deferred function with an unsatified prerequisite" do
698+
Puppet[:preprocess_deferred] = true
699+
698700
apply.command_line.args = ['-e', deferred_manifest]
699701
expect {
700702
apply.run
@@ -704,8 +706,6 @@ def bogus()
704706
end
705707

706708
it "applies a deferred function and its prerequisite in the same run" do
707-
Puppet[:preprocess_deferred] = false
708-
709709
apply.command_line.args = ['-e', deferred_manifest]
710710
expect {
711711
apply.run
@@ -714,6 +714,7 @@ def bogus()
714714
end
715715

716716
it "validates the deferred resource before applying any resources" do
717+
Puppet[:preprocess_deferred] = true
717718
undeferred_file = tmpfile('undeferred')
718719

719720
manifest = <<~END
@@ -738,8 +739,6 @@ def bogus()
738739
end
739740

740741
it "evaluates resources before validating the deferred resource" do
741-
Puppet[:preprocess_deferred] = false
742-
743742
manifest = <<~END
744743
notify { 'runs before file': } ->
745744
file { '#{deferred_file}':

0 commit comments

Comments
 (0)