packer-cn/builder/vmware/common/driver_config.go

32 lines
995 B
Go
Raw Normal View History

package common
import (
2014-10-28 11:37:12 -04:00
"os"
2017-04-04 16:39:01 -04:00
"github.com/hashicorp/packer/template/interpolate"
)
type DriverConfig struct {
FusionAppPath string `mapstructure:"fusion_app_path"`
RemoteType string `mapstructure:"remote_type"`
RemoteDatastore string `mapstructure:"remote_datastore"`
RemoteCacheDatastore string `mapstructure:"remote_cache_datastore"`
RemoteCacheDirectory string `mapstructure:"remote_cache_directory"`
RemoteHost string `mapstructure:"remote_host"`
RemotePort uint `mapstructure:"remote_port"`
RemoteUser string `mapstructure:"remote_username"`
RemotePassword string `mapstructure:"remote_password"`
RemotePrivateKey string `mapstructure:"remote_private_key_file"`
}
2015-05-27 17:16:28 -04:00
func (c *DriverConfig) Prepare(ctx *interpolate.Context) []error {
if c.FusionAppPath == "" {
c.FusionAppPath = os.Getenv("FUSION_APP_PATH")
}
if c.FusionAppPath == "" {
c.FusionAppPath = "/Applications/VMware Fusion.app"
}
2015-05-27 17:16:28 -04:00
return nil
}