Bug #8119
PATCH - Write to a temporary file and move when storing reports.
| Status: | Closed | Start date: | 06/28/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | reports | |||
| Target version: | 2.7.10 | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | ||||
| Votes: | 0 |
Description
When writing reports, there is a window in between opening and writing to the report file when the report file exists as an empty file. This makes writing report processors a little annoying as they have to deal with this case. This patch writes the report into a temporary file then renames it to the report file, which eliminates this window.
http://ricky.fedorapeople.org/puppet/0001-Write-to-a-temporary-file-and-move-when-storing-repo.patch
Related issues
History
Updated by James Turnbull 10 months ago
- Category set to reports
- Status changed from Unreviewed to Needs More Information
- Target version set to 2.7.x
Ricky – what’s the failure you see here? Something hoovering up the report file before it’s written?
Updated by Ricky Zhou 9 months ago
Yeah – the use case is that we’re using a script in a cronjob to parse reports – the script just reads the newest report file in each directory. However, if the script happens to run at the same time as puppet is being run, it’ll sometimes see an empty file because puppet hasn’t had a chance to write it yet. Writing to a temporary file and moving it in place would ensure this can’t happen.
Updated by R.I. Pienaar 9 months ago
Closely related to #5692, this is something we should fix in many places.
Updated by James Turnbull 9 months ago
- Assignee set to Ricky Zhou
Ricky – would you be able to submit a pull request/git branch for this patch – it helps maintain your authorship etc.
Updated by Ricky Zhou 9 months ago
Sure thing – the ticket/master/8119 branch at http://fedorapeople.org/git/gitweb.cgi?p=ricky/public_git/puppet.git should have the commit – alternatively, I think
wget http://ricky.fedorapeople.org/puppet/0001-Write-to-a-temporary-file-and-move-when-storing-repo.patch git am 0001-Write-to-a-temporary-file-and-move-when-storing-repo.patch
would also preserve authorship if that’s easier for you.
Updated by James Turnbull 9 months ago
- Status changed from Needs More Information to In Topic Branch Pending Review
- Assignee changed from Ricky Zhou to James Turnbull
Pull request submitted.
Updated by Daniel Pittman 9 months ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
- Target version changed from 2.7.x to 2.7.4
Updated by Nick Lewis 9 months ago
The pull request is at https://github.com/puppetlabs/puppet/pull/83 and was merged in commit:1f69bd3c2011bbde6e6910d66c53a5af5e1b2ced.
Updated by Daniel Pittman 9 months ago
- Status changed from Merged - Pending Release to Code Insufficient
- Target version changed from 2.7.4 to 3.x
This code is incomplete; it broke some tests, and has been reverted.
Updated by James Turnbull 9 months ago
- Status changed from Code Insufficient to In Topic Branch Pending Review
I’ve updated the patch to fix the failing tests.
Updated by Patrick Carlisle 5 months ago
Why was this retargeted at Telly? I’m ready to merge, but waiting on that since it was originally targeted at 2.7.x and that still makes sense to me.
Updated by Daniel Pittman 5 months ago
- Assignee changed from James Turnbull to Patrick Carlisle
Patrick Carlisle wrote:
Why was this retargeted at Telly? I’m ready to merge, but waiting on that since it was originally targeted at 2.7.x and that still makes sense to me.
I don’t recall, and foolishly didn’t record whatever conversation led to that decision. I don’t see any problem that prevents this applying inside the 2.7 series, assuming that the code is implementation only and there are no user visible effects of it. (Other than, say, less races ;)
Updated by Patrick Carlisle 5 months ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
- Target version changed from 3.x to 2.7.10
I’ve merged into 2.7.x in commit:2fd94d2e912a1b0dcc08ff510658948644a7fc1c
(#8119) Write reports to a temporary file and move them into place
When writing reports, there is a window in between opening and writing to the
report file when the report file exists as an empty file. This makes writing
report processors a little annoying as they have to deal with this case. This
writes the report into a temporary file then renames it to the report file.
Updated by Michael Stahnke 4 months ago
- Status changed from Merged - Pending Release to Closed
released 2.7.10rc1