From 549ff50a3c390a9f6bed050f00ae047f14bb3765 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Tue, 27 Dec 2016 14:58:41 -0600 Subject: [PATCH] provisioner(converge): handle http error --- provisioner/converge/provisioner.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/provisioner/converge/provisioner.go b/provisioner/converge/provisioner.go index 85dd1da6f..194e85083 100644 --- a/provisioner/converge/provisioner.go +++ b/provisioner/converge/provisioner.go @@ -137,13 +137,15 @@ func (p *Provisioner) maybeBootstrap(ui packer.Ui, comm packer.Communicator) err ui.Message("bootstrapping converge") bootstrap, err := http.Get("https://get.converge.sh") - defer bootstrap.Body.Close() if err != nil { return fmt.Errorf("Error downloading bootstrap script: %s", err) // TODO: is github.com/pkg/error allowed? } if err := comm.Upload("/tmp/install-converge.sh", bootstrap.Body, nil); err != nil { return fmt.Errorf("Error uploading script: %s", err) } + if err := bootstrap.Body.Close(); err != nil { + return fmt.Errorf("Error getting bootstrap script: %s", err) + } // construct command command := "/bin/sh /tmp/install-converge.sh"