updating error messages
This commit is contained in:
Родитель
b73cc912e9
Коммит
c07ee2ca08
12
main/cmds.go
12
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче