diff --git a/builder/lxd/communicator.go b/builder/lxd/communicator.go index fe4aa7f..25abc77 100644 --- a/builder/lxd/communicator.go +++ b/builder/lxd/communicator.go @@ -11,6 +11,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "syscall" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" @@ -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) log.Printf(pushCommand) cp, err := c.CmdWrapper(pushCommand) if err != nil {