2015-10-20 18:00:48 -04:00
|
|
|
package none
|
|
|
|
|
|
|
|
import (
|
2019-04-03 11:14:55 -04:00
|
|
|
"context"
|
2015-10-20 18:00:48 -04:00
|
|
|
"errors"
|
|
|
|
"io"
|
|
|
|
"os"
|
2017-08-23 17:09:39 -04:00
|
|
|
|
2020-11-19 18:10:00 -05:00
|
|
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
2015-10-20 18:00:48 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type comm struct {
|
2016-02-08 20:34:06 -05:00
|
|
|
config string
|
2015-10-20 18:00:48 -04:00
|
|
|
}
|
|
|
|
|
2020-11-19 18:10:00 -05:00
|
|
|
// Creates a null packersdk.Communicator implementation. This takes
|
2015-10-20 18:00:48 -04:00
|
|
|
// an already existing configuration.
|
|
|
|
func New(config string) (result *comm, err error) {
|
|
|
|
// Establish an initial connection and connect
|
|
|
|
result = &comm{
|
2016-02-08 20:34:06 -05:00
|
|
|
config: config,
|
2015-10-20 18:00:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-11-19 18:10:00 -05:00
|
|
|
func (c *comm) Start(ctx context.Context, cmd *packersdk.RemoteCmd) (err error) {
|
2015-10-20 18:00:48 -04:00
|
|
|
cmd.SetExited(0)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *comm) Upload(path string, input io.Reader, fi *os.FileInfo) error {
|
|
|
|
return errors.New("Upload is not implemented when communicator = 'none'")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *comm) UploadDir(dst string, src string, excl []string) error {
|
|
|
|
return errors.New("UploadDir is not implemented when communicator = 'none'")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *comm) Download(path string, output io.Writer) error {
|
|
|
|
return errors.New("Download is not implemented when communicator = 'none'")
|
|
|
|
}
|
2016-06-30 15:58:07 -04:00
|
|
|
|
|
|
|
func (c *comm) DownloadDir(dst string, src string, excl []string) error {
|
|
|
|
return errors.New("DownloadDir is not implemented when communicator = 'none'")
|
|
|
|
}
|