Skip to content

(maint) Reset "tasks" setting after with_script_compiler #7822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/puppet/pal/pal_impl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ def self.with_script_compiler(
end
end

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

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

# Evaluates a Puppet Language script string.
Expand Down