[lxc] implement interface, add validation
This commit is contained in:
parent
f4f0ab9f50
commit
341ebdd7e8
|
@ -104,6 +104,10 @@ func (c *LxcAttachCommunicator) Download(src string, w io.Writer) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *LxcAttachCommunicator) DownloadDir(src string, dst string, exclude []string) error {
|
||||
return fmt.Errorf("DownloadDir is not implemented for lxc")
|
||||
}
|
||||
|
||||
func (c *LxcAttachCommunicator) Execute(commandString string) (*exec.Cmd, error) {
|
||||
log.Printf("Executing with lxc-attach in container: %s %s %s", c.ContainerName, c.RootFs, commandString)
|
||||
command, err := c.CmdWrapper(
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
"github.com/mitchellh/packer/template/interpolate"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
@ -62,6 +63,10 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
|||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Failed parsing init_timeout: %s", err))
|
||||
}
|
||||
|
||||
if _, err := os.Stat(c.ConfigFile); os.IsNotExist(err) {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("LXC Config file appears to be missing: %s", c.ConfigFile))
|
||||
}
|
||||
|
||||
if errs != nil && len(errs.Errors) > 0 {
|
||||
return nil, errs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue