check for no communicator and provide messaging to user

This commit is contained in:
James Griffith 2020-09-18 16:00:30 -04:00 committed by Megan Marsh
parent 2ecf5cc9aa
commit 1048cdbcc4
1 changed files with 11 additions and 1 deletions

View File

@ -55,7 +55,17 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
return multistep.ActionContinue return multistep.ActionContinue
} }
if s.Config.DisableShutdown { if state.Get("communicator") == nil {
ui.Say("The `communicator` is 'none', automatic shutdown disabled.")
if s.Config.Command != "" {
ui.Message("The parameter `shutdown_command` is ignored as it requires a `communicator`.")
}
msg := fmt.Sprintf("Please shutdown virtual machine within %s.", s.Config.Timeout)
ui.Message(msg)
} else if s.Config.DisableShutdown {
ui.Say("Automatic shutdown disabled. Please shutdown virtual machine.") ui.Say("Automatic shutdown disabled. Please shutdown virtual machine.")
} else if s.Config.Command != "" { } else if s.Config.Command != "" {
// Communicator is not needed unless shutdown_command is populated // Communicator is not needed unless shutdown_command is populated