mirror of
https://github.com/hashicorp/packer.git
synced 2026-04-22 06:37:02 -04:00
Merge b805f540a3 into 33740b7c61
This commit is contained in:
commit
64ff8334ea
3 changed files with 13 additions and 1 deletions
|
|
@ -67,6 +67,11 @@ type Config struct {
|
|||
// the Packer run, but realize that there are situations where this may be
|
||||
// unavoidable.
|
||||
Generated bool `mapstructure:"generated" required:"false"`
|
||||
// A list of files or directories to exclude from the upload. This is
|
||||
// useful if you have a directory with many files and you only want to
|
||||
// upload a few of them. This only works if you are uploading a directory
|
||||
// and not a single file.
|
||||
Excludes []string `mapstructure:"excludes" required:"false"`
|
||||
|
||||
ctx interpolate.Context
|
||||
}
|
||||
|
|
@ -227,7 +232,7 @@ func (p *Provisioner) ProvisionUpload(ui packersdk.Ui, comm packersdk.Communicat
|
|||
|
||||
// If we're uploading a directory, short circuit and do that
|
||||
if info.IsDir() {
|
||||
if err = comm.UploadDir(dst, src, nil); err != nil {
|
||||
if err = comm.UploadDir(dst, src, p.config.Excludes); err != nil {
|
||||
ui.Error(fmt.Sprintf("Upload failed: %s", err))
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ type FlatConfig struct {
|
|||
Destination *string `mapstructure:"destination" required:"true" cty:"destination" hcl:"destination"`
|
||||
Direction *string `mapstructure:"direction" required:"false" cty:"direction" hcl:"direction"`
|
||||
Generated *bool `mapstructure:"generated" required:"false" cty:"generated" hcl:"generated"`
|
||||
Excludes []string `mapstructure:"excludes" required:"false" cty:"excludes" hcl:"excludes"`
|
||||
}
|
||||
|
||||
// FlatMapstructure returns a new FlatConfig.
|
||||
|
|
@ -52,6 +53,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
|||
"destination": &hcldec.AttrSpec{Name: "destination", Type: cty.String, Required: false},
|
||||
"direction": &hcldec.AttrSpec{Name: "direction", Type: cty.String, Required: false},
|
||||
"generated": &hcldec.AttrSpec{Name: "generated", Type: cty.Bool, Required: false},
|
||||
"excludes": &hcldec.AttrSpec{Name: "excludes", Type: cty.List(cty.String), Required: false},
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,9 @@
|
|||
the Packer run, but realize that there are situations where this may be
|
||||
unavoidable.
|
||||
|
||||
- `excludes` ([]string) - A list of files or directories to exclude from the upload. This is
|
||||
useful if you have a directory with many files and you only want to
|
||||
upload a few of them. This only works if you are uploading a directory
|
||||
and not a single file.
|
||||
|
||||
<!-- End of code generated from the comments of the Config struct in provisioner/file/provisioner.go; -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue