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

fix: Do not create base folder on remote when uploading dir #75

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

Novakov
Copy link
Contributor

@Novakov Novakov commented Jul 14, 2023

Calling lxc files push dir/ instance:/tmp/abc will create folder /tmp/abc/dir with all files inside which does not match behavior expected by Packer - files should be placed directly under /tmp/abc.

Use lxc files push dir/* to upload files to proper directory

Closes #7

@Novakov Novakov requested a review from a team as a code owner July 14, 2023 14:01
@hashicorp-cla
Copy link

hashicorp-cla commented Jul 14, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Hey @Novakov,

First, sorry for the delay in the review.

Looking at the code, this does look consistent with what the UploadDir function is supposed to do, so I'm enclined to approve this.

I left a small suggestion to the actual change regarding src, just to be sure we are not globbing the directory's name itself, otherwise this will continue behaving as it does now, with the extra added risk of having other directories copied at the same time.

Other than that, this looks good to me, I'll come back to this PR when you've had a chance to address this feedback.
Alternatively if you prefer or lack time to fix this, I can take care of that, please let me know if that's the case.

Thanks for the PR!

builder/lxd/communicator.go Show resolved Hide resolved
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the reroll @Novakov, much appreciated.

Will merge this today

@@ -12,6 +12,7 @@ import (
"os/exec"
"path/filepath"
"syscall"
"strings"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the imports aren't in alphabetical order here, our linters fail.

Could you run goimports on the file and update this PR? I couldn't do it since I don't have the permission to push on your remote.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be better now

Copy link
Contributor

Choose a reason for hiding this comment

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

All good indeed, many thanks @Novakov !

Calling lxc files push dir/ instance:/tmp/abc will create folder
/tmp/abc/dir with all files inside which does not match behavior
expected by Packer - files should be placed directly under /tmp/abc.

Use lxc files push dir/* to upload files to proper directory
@lbajolet-hashicorp lbajolet-hashicorp merged commit 9fd92d1 into hashicorp:main Sep 14, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LXD file provisioner uploads directory to the wrong folder when source has trailing slash
3 participants