Skip to content

Commit 4cae5c9

Browse files
authored
Merge pull request #7822 from nicklewis/reset-tasks-setting-in-script-compiler
(maint) Reset "tasks" setting after with_script_compiler
2 parents 794a05f + c2e2aaf commit 4cae5c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/puppet/pal/pal_impl.rb

+5
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,18 @@ def self.with_script_compiler(
8383
end
8484
end
8585

86+
previous_tasks_value = Puppet[:tasks]
87+
previous_code_value = Puppet[:code]
8688
Puppet[:tasks] = true
8789
# After the assertions, if code_string is non nil - it has the highest precedence
8890
Puppet[:code] = code_string unless code_string.nil?
8991

9092
# If manifest_file is nil, the #main method will use the env configured manifest
9193
# to do things in the block while a Script Compiler is in effect
9294
main(manifest_file, facts, variables, :script, &block)
95+
ensure
96+
Puppet[:tasks] = previous_tasks_value
97+
Puppet[:code] = previous_code_value
9398
end
9499

95100
# Evaluates a Puppet Language script string.

0 commit comments

Comments
 (0)