From 1048cdbcc4e57822e2ffe8c0f0c765c4cfeecba2 Mon Sep 17 00:00:00 2001 From: James Griffith Date: Fri, 18 Sep 2020 16:00:30 -0400 Subject: [PATCH] check for no communicator and provide messaging to user --- builder/vsphere/common/step_shutdown.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/builder/vsphere/common/step_shutdown.go b/builder/vsphere/common/step_shutdown.go index 78319fd4d..fab80dcd2 100644 --- a/builder/vsphere/common/step_shutdown.go +++ b/builder/vsphere/common/step_shutdown.go @@ -55,7 +55,17 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis 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.") } else if s.Config.Command != "" { // Communicator is not needed unless shutdown_command is populated