f555e7a9f2
* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer. Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock * cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions * also had to simplify StartWithUi
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package none
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"os"
|
|
|
|
"github.com/hashicorp/packer/packer"
|
|
)
|
|
|
|
type comm struct {
|
|
config string
|
|
}
|
|
|
|
// Creates a null packer.Communicator implementation. This takes
|
|
// an already existing configuration.
|
|
func New(config string) (result *comm, err error) {
|
|
// Establish an initial connection and connect
|
|
result = &comm{
|
|
config: config,
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
func (c *comm) Start(ctx context.Context, cmd *packer.RemoteCmd) (err error) {
|
|
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'")
|
|
}
|
|
|
|
func (c *comm) DownloadDir(dst string, src string, excl []string) error {
|
|
return errors.New("DownloadDir is not implemented when communicator = 'none'")
|
|
}
|