Adding OnHostMaintenance option for googlecompue builder
This commit is contained in:
parent
e04f87effe
commit
bab590c177
|
@ -39,6 +39,7 @@ type Config struct {
|
|||
Network string `mapstructure:"network"`
|
||||
NetworkProjectId string `mapstructure:"network_project_id"`
|
||||
OmitExternalIP bool `mapstructure:"omit_external_ip"`
|
||||
OnHostMaintenance string `mapstructure:"on_host_maintenance"`
|
||||
Preemptible bool `mapstructure:"preemptible"`
|
||||
RawStateTimeout string `mapstructure:"state_timeout"`
|
||||
Region string `mapstructure:"region"`
|
||||
|
@ -92,6 +93,12 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
if c.ImageDescription == "" {
|
||||
c.ImageDescription = "Created by Packer"
|
||||
}
|
||||
// Possible values:
|
||||
// "MIGRATE"
|
||||
// "TERMINATE"
|
||||
if c.OnHostMaintenance == "" {
|
||||
c.OnHostMaintenance = "MIGRATE"
|
||||
}
|
||||
|
||||
if c.ImageName == "" {
|
||||
img, err := interpolate.Render("packer-{{timestamp}}", nil)
|
||||
|
|
|
@ -104,6 +104,21 @@ func TestConfigPrepare(t *testing.T) {
|
|||
"SO VERY BAD",
|
||||
true,
|
||||
},
|
||||
{
|
||||
"on_host_maintenance",
|
||||
nil,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"on_host_maintenance",
|
||||
"TERMINATE",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"on_host_maintenance",
|
||||
"SO VERY BAD",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"preemptible",
|
||||
nil,
|
||||
|
|
|
@ -69,6 +69,7 @@ type InstanceConfig struct {
|
|||
Network string
|
||||
NetworkProjectId string
|
||||
OmitExternalIP bool
|
||||
OnHostMaintenance string
|
||||
Preemptible bool
|
||||
Region string
|
||||
Scopes []string
|
||||
|
|
|
@ -386,7 +386,8 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|||
},
|
||||
},
|
||||
Scheduling: &compute.Scheduling{
|
||||
Preemptible: c.Preemptible,
|
||||
OnHostMaintenance: c.OnHostMaintenance,
|
||||
Preemptible: c.Preemptible,
|
||||
},
|
||||
ServiceAccounts: []*compute.ServiceAccount{
|
||||
{
|
||||
|
|
|
@ -110,6 +110,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
Network: c.Network,
|
||||
NetworkProjectId: c.NetworkProjectId,
|
||||
OmitExternalIP: c.OmitExternalIP,
|
||||
OnHostMaintenance: c.OnHostMaintenance,
|
||||
Preemptible: c.Preemptible,
|
||||
Region: c.Region,
|
||||
ServiceAccountEmail: c.Account.ClientEmail,
|
||||
|
|
Loading…
Reference in New Issue