Skip to content

Commit

Permalink
remove provisioner as receiver of uploadfiles util func
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Dec 12, 2024
1 parent c60dbd9 commit 6432528
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### 1.5.0 (Next)

### 1.4.2
- Significantly improve Packer SSH and WinRM communicators settings' interfacing with provisioner plugin.

Expand Down
2 changes: 1 addition & 1 deletion provisioner/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// helper function to transfer files from local device to temporary packer instance
func (provisioner *Provisioner) uploadFiles(comm packer.Communicator, files []string, destDir string) error {
func uploadFiles(comm packer.Communicator, files []string, destDir string) error {
var err error

// iterate through files to transfer
Expand Down
5 changes: 2 additions & 3 deletions provisioner/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import (
)

func TestProvisionerUploadFiles(test *testing.T) {
var provisioner Provisioner
comm := new(packer.MockCommunicator)

err := provisioner.uploadFiles(comm, []string{}, "/tmp/")
err := uploadFiles(comm, []string{}, "/tmp/")
if err != nil {
test.Errorf("uploadFiles with empty files slice input returned error")
test.Error(err)
}

err = provisioner.uploadFiles(comm, []string{"foobar"}, "/tmp/")
err = uploadFiles(comm, []string{"foobar"}, "/tmp/")
if !errors.Is(err, os.ErrNotExist) {
test.Errorf("expected nonexistent file to return ErrNotExist error, but instead %s was returned", err)
}
Expand Down

0 comments on commit 6432528

Please sign in to comment.