From 7c358eed2fbe8424f950ef94d9c6f5936ee2cd90 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 28 Aug 2018 14:55:20 +0200 Subject: [PATCH] removed unused builder/azure/common/lin.StepGeneralizeOS struct --- .../azure/common/lin/step_generalize_os.go | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 builder/azure/common/lin/step_generalize_os.go diff --git a/builder/azure/common/lin/step_generalize_os.go b/builder/azure/common/lin/step_generalize_os.go deleted file mode 100644 index cc62f4eec..000000000 --- a/builder/azure/common/lin/step_generalize_os.go +++ /dev/null @@ -1,56 +0,0 @@ -package lin - -import ( - "bytes" - "context" - "fmt" - "log" - - "github.com/hashicorp/packer/helper/multistep" - "github.com/hashicorp/packer/packer" -) - -type StepGeneralizeOS struct { - Command string -} - -func (s *StepGeneralizeOS) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) - comm := state.Get("communicator").(packer.Communicator) - - ui.Say("Executing OS generalization...") - - var stdout, stderr bytes.Buffer - cmd := &packer.RemoteCmd{ - Command: s.Command, - Stdout: &stdout, - Stderr: &stderr, - } - - if err := comm.Start(cmd); err != nil { - err = fmt.Errorf("Failed executing OS generalization command: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } - - // Wait for the command to run - cmd.Wait() - - // If the command failed to run, notify the user in some way. - if cmd.ExitStatus != 0 { - state.Put("error", fmt.Errorf( - "OS generalization has non-zero exit status.\n\nStdout: %s\n\nStderr: %s", - stdout.String(), stderr.String())) - return multistep.ActionHalt - } - - log.Printf("OS generalization stdout: %s", stdout.String()) - log.Printf("OS generalization stderr: %s", stderr.String()) - - return multistep.ActionContinue -} - -func (s *StepGeneralizeOS) Cleanup(state multistep.StateBag) { - // do nothing -}