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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion builder/lxd/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"path/filepath"
"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 !

"syscall"

packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
Expand Down Expand Up @@ -92,7 +93,10 @@ func (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error {

func (c *Communicator) UploadDir(dst string, src string, exclude []string) error {
fileDestination := fmt.Sprintf("%s/%s", c.ContainerName, dst)
pushCommand := fmt.Sprintf("lxc file push --debug -pr %s %s", src, fileDestination)
if !strings.HasSuffix(src, "/") {
src += "/"
}
pushCommand := fmt.Sprintf("lxc file push --debug -pr %s* %s", src, fileDestination)
lbajolet-hashicorp marked this conversation as resolved.
Show resolved Hide resolved
log.Printf(pushCommand)
cp, err := c.CmdWrapper(pushCommand)
if err != nil {
Expand Down