puppetlabs / puppetlabs/bolt

`download_file` shouldn't be destructive

Open
#3,198 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Ruby
Stars
558
Forks
224
Avg merge
1h 4m
Merged PRs (30d)
1

Description

Describe the Bug

The built-in download_file function is destructive and will remove existing files of the destination directory. This is a problem when trying to download multiple files from a target that would result in calling download_file twice.

This might not be considered a bug, but it is definitely undesirable behavior from my point of view.

Expected Behavior

Stop removing files. Overwrite behavior is probably fine, but I can imagine situations where that wouldn't be desirable. Perhaps this could be a config option.

Steps to Reproduce

Steps to reproduce the behavior:
From a single plan perform the following actions:

  1. Call download_file('/src/foo.txt', 'foo.txt', $target)
  2. Call download_file('/src/bar.txt', 'bar.txt', $target)
  3. Inspect downloads/<target> to see that foo.txt has been deleted.

Environment

  • Version 3.26.1
  • Platform Ubuntu 20.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the built-in download_file entry point and reproduce the two-call sequence described in the issue against a target download directory. Confirm that downloading bar.txt no longer removes foo.txt, and add or update coverage for this behavior if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.