Skip to content

[file] Only evaluate lazy block once for content#15714

Merged
jaymzh merged 1 commit into
chef:mainfrom
dafyddcrosby:main_file_content
Apr 1, 2026
Merged

[file] Only evaluate lazy block once for content#15714
jaymzh merged 1 commit into
chef:mainfrom
dafyddcrosby:main_file_content

Conversation

@dafyddcrosby
Copy link
Copy Markdown
Contributor

@dafyddcrosby dafyddcrosby commented Mar 16, 2026

Description

This is to address #15713, where lazy evaluation occurs multiple times during the course of a run when doing something like:

file '/tmp/foo' do
  content lazy { something_expensive }
end

With this change, that lazy evaluation only happens once, when it's writing the temporary file for comparison

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@dafyddcrosby dafyddcrosby marked this pull request as ready for review March 16, 2026 19:54
@dafyddcrosby dafyddcrosby requested review from a team and jaymzh as code owners March 16, 2026 19:54
Signed-off-by: dcrosby <dcrosby@meta.com>
@sonarqubecloud
Copy link
Copy Markdown

@jaymzh jaymzh merged commit 524e7df into chef:main Apr 1, 2026
93 of 100 checks passed
jaymzh pushed a commit that referenced this pull request Apr 1, 2026
backport of #15714

Signed-off-by: dcrosby <dcrosby@meta.com>
@neha-p6
Copy link
Copy Markdown
Collaborator

neha-p6 commented Apr 24, 2026

backport to 18 #15715

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants