Skip to content

Commit 33fc558

Browse files
committed
file: use excludes list to excl files when uploading a directory
Resolves: #9671
1 parent 6d6727b commit 33fc558

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

provisioner/file/provisioner.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ type Config struct {
6767
// the Packer run, but realize that there are situations where this may be
6868
// unavoidable.
6969
Generated bool `mapstructure:"generated" required:"false"`
70+
// A list of files or directories to exclude from the upload. This is
71+
// useful if you have a directory with many files and you only want to
72+
// upload a few of them. This only works if you are uploading a directory
73+
// and not a single file.
74+
Excludes []string `mapstructure:"excludes" required:"false"`
7075

7176
ctx interpolate.Context
7277
}
@@ -227,7 +232,7 @@ func (p *Provisioner) ProvisionUpload(ui packersdk.Ui, comm packersdk.Communicat
227232

228233
// If we're uploading a directory, short circuit and do that
229234
if info.IsDir() {
230-
if err = comm.UploadDir(dst, src, nil); err != nil {
235+
if err = comm.UploadDir(dst, src, p.config.Excludes); err != nil {
231236
ui.Error(fmt.Sprintf("Upload failed: %s", err))
232237
return err
233238
}

0 commit comments

Comments
 (0)