diff --git a/main/cmds.go b/main/cmds.go index 65c37b5..d5e2bba 100644 --- a/main/cmds.go +++ b/main/cmds.go @@ -116,7 +116,7 @@ func uninstall(ctx *log.Context, h vmextension.HandlerEnvironment, seqNum int) ( ctx = ctx.With("path", dataDir) ctx.Log("event", "removing data dir", "path", dataDir) if err := os.RemoveAll(dataDir); err != nil { - return "", errors.Wrap(err, "failed to delete data dir") + return "", errors.Wrap(err, "failed to delete data directory") } ctx.Log("event", "removed data dir") } @@ -128,9 +128,9 @@ func enablePre(ctx *log.Context, seqNum int) error { // exit if this sequence number (a snapshot of the configuration) is already // processed. if not, save this sequence number before proceeding. if shouldExit, err := checkAndSaveSeqNum(ctx, seqNum, mostRecentSequence); err != nil { - return errors.Wrap(err, "failed to process seqnum") + return errors.Wrap(err, "failed to process sequence number") } else if shouldExit { - ctx.Log("event", "exit", "message", "this script configuration is already processed, will not run again") + ctx.Log("event", "exit", "message", "the script configuration has already been processed, will not run again") os.Exit(0) } return nil @@ -197,7 +197,7 @@ func checkAndSaveSeqNum(ctx log.Logger, seq int, mrseqPath string) (shouldExit b return true, nil } if err := seqnum.Set(mrseqPath, seq); err != nil { - return false, errors.Wrap(err, "failed to save the sequence number") + return false, errors.Wrap(err, "failed to save sequence number") } ctx.Log("event", "seqnum saved", "path", mrseqPath) return false, nil @@ -307,7 +307,7 @@ func writeTempScript(script, dir string, skipDosToUnix bool) (string, string, er if skipDosToUnix == false { err = postProcessFile(cmd) if err != nil { - return "", "", errors.Wrap(err, "failed to post process file") + return "", "", errors.Wrap(err, "failed to post-process script.sh") } dos2unix = 0 } @@ -319,7 +319,7 @@ func decodeScript(script string) (string, string, error) { // scripts must be base64 encoded s, err := base64.StdEncoding.DecodeString(script) if err != nil { - return "", "", errors.Wrap(err, "failed to base64 decode script") + return "", "", errors.Wrap(err, "failed to decode script") } // scripts may be gzip'ed diff --git a/main/files.go b/main/files.go index 71dbb64..21cebe7 100644 --- a/main/files.go +++ b/main/files.go @@ -115,7 +115,7 @@ func urlToFileName(fileURL string) (string, error) { func postProcessFile(path string) error { ok, err := preprocess.IsTextFile(path) if err != nil { - return errors.Wrapf(err, "error determining if script file") + return errors.Wrapf(err, "error determining if script is a text file") } if !ok { return nil diff --git a/pkg/download/blobwithmsitoken.go b/pkg/download/blobwithmsitoken.go index a5f59b5..6803e9e 100644 --- a/pkg/download/blobwithmsitoken.go +++ b/pkg/download/blobwithmsitoken.go @@ -36,7 +36,7 @@ func (self *blobWithMsiToken) GetRequest() (*http.Request, error) { return nil, err } if msi.AccessToken == "" { - return nil, errors.New("MSI token was empty") + return nil, errors.New("MSI token is empty") } request, err := http.NewRequest(http.MethodGet, self.url, nil) diff --git a/pkg/download/downloader.go b/pkg/download/downloader.go index 45041c7..d5941bd 100644 --- a/pkg/download/downloader.go +++ b/pkg/download/downloader.go @@ -40,7 +40,7 @@ var ( func Download(d Downloader) (int, io.ReadCloser, error) { req, err := d.GetRequest() if err != nil { - return -1, nil, errors.Wrapf(err, "failed to create the request") + return -1, nil, errors.Wrapf(err, "failed to create http request") } resp, err := httpClient.Do(req)