Skip to content
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

ruby provider: ensure cleanup happens #474

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

pillarsdotnet
Copy link
Contributor

@pillarsdotnet pillarsdotnet commented Sep 29, 2022

Pull Request (PR) description

Ensures that tempfile used for downloading gets deleted.
Ensures that the cleanup param is honored.

This Pull Request (PR) fixes the following issues

Fixes #328

@bastelfreak bastelfreak added the bug Something isn't working label Nov 23, 2022
@bastelfreak
Copy link
Member

Hi @pillarsdotnet, thanks for the PR. can you please rebase against our latest master branch?

@pillarsdotnet
Copy link
Contributor Author

Rebased.

@pillarsdotnet
Copy link
Contributor Author

@bastelfreak -- Would you please review?

@kenyon
Copy link
Member

kenyon commented Dec 7, 2022

@kenyon kenyon changed the title 328 - Ensure cleanup happens ruby provider: ensure cleanup happens Dec 8, 2022
@pillarsdotnet
Copy link
Contributor Author

@kenyon -- Thanks for fixes.

Copy link
Member

@kenyon kenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would be nice to have a test for this though.

Copy link
Member

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I pushed a commit to make rubocop happy.

raise(Puppet::Error, "Download file checksum mismatch (expected: #{checksum} actual: #{actual_checksum})")
end
end

move_file_in_place(temppath, archive_filepath)
ensure
FileUtils.rm_f(temppath) if File.exist?(temppath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you can rm_f a file that does not exist (because force is only about ignoring errors). Checking for existence does not hurt though, so I am fine with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot clean up unless 'creates' is specified.
4 participants