Skip to content

Commit

Permalink
Simplify the machine restart policy (#3215)
Browse files Browse the repository at this point in the history
We can just set the policy to no, instead of having a random empty branch
  • Loading branch information
billyb2 committed Jan 31, 2024
1 parent b99f210 commit ba9886a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/command/machine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,11 @@ func determineMachineConfig(
// An empty policy was explicitly requested.
machineConf.Restart.Policy = ""
} else if machineConf.AutoDestroy {
// Autodestroy only works when the restart policy is set to no, so unless otherwise specified, we set the restart policy to no.
machineConf.Restart.Policy = api.MachineRestartPolicyNo
} else if !input.updating {
// This is a new machine; apply the default.
if machineConf.AutoDestroy {
// Autodestroy only works when the restart policy is set to no, so unless otherwise specified, we set the restart policy to no.
machineConf.Restart.Policy = api.MachineRestartPolicyNo
} else if machineConf.Schedule != "" {
if machineConf.Schedule != "" {
machineConf.Restart.Policy = api.MachineRestartPolicyOnFailure
} else {
machineConf.Restart.Policy = api.MachineRestartPolicyAlways
Expand Down

0 comments on commit ba9886a

Please sign in to comment.