From 0124d7ec998afa21e1e104ba5f0acd4e1a7713b1 Mon Sep 17 00:00:00 2001 From: Matt Richerson Date: Thu, 7 Sep 2023 11:40:17 -0500 Subject: [PATCH 1/2] Use GetUserMessage() for resource errors Use the GetUserMessage() receiver function when getting the user message for a resource error. This will properly prefix the message with the error type. Signed-off-by: Matt Richerson --- controllers/nnf_workflow_controller_helpers.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- .../HewlettPackard/dws/api/v1alpha2/resource_error.go | 4 ++++ vendor/modules.txt | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controllers/nnf_workflow_controller_helpers.go b/controllers/nnf_workflow_controller_helpers.go index 91380f706..87767188d 100644 --- a/controllers/nnf_workflow_controller_helpers.go +++ b/controllers/nnf_workflow_controller_helpers.go @@ -839,7 +839,7 @@ func handleWorkflowError(err error, driverStatus *dwsv1alpha2.WorkflowDriverStat driverStatus.Error = err.Error() } else { driverStatus.Status = status - driverStatus.Message = e.UserMessage + driverStatus.Message = e.GetUserMessage() driverStatus.Error = e.Error() } } else { diff --git a/go.mod b/go.mod index 714c3d127..b66762cf5 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/NearNodeFlash/nnf-sos go 1.19 require ( - github.com/HewlettPackard/dws v0.0.1-0.20230815174614-998c6ad6bd1d + github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20230613180840-6178f2b04900 github.com/NearNodeFlash/nnf-ec v0.0.0-20230526161255-cfb2d89b35d7 github.com/ghodss/yaml v1.0.0 diff --git a/go.sum b/go.sum index 80886c8a1..619c1b8f6 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/HewlettPackard/dws v0.0.1-0.20230815174614-998c6ad6bd1d h1:QZKgq7r+4ZUOGV5IPT/HUYWxVMT7vLrYmOV5yvwB6IA= -github.com/HewlettPackard/dws v0.0.1-0.20230815174614-998c6ad6bd1d/go.mod h1:YvNzcgAPmwhl/YQj6dMwsB9OpwbI5bp/41kINfFiXX8= +github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 h1:BigoG7b53CPEkdjH2VxM0iZrgVfuzOLtEVjwPIJx/bc= +github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329/go.mod h1:YvNzcgAPmwhl/YQj6dMwsB9OpwbI5bp/41kINfFiXX8= github.com/HewlettPackard/structex v1.0.4 h1:RVTdN5FWhDWr1IkjllU8wxuLjISo4gr6u5ryZpzyHcA= github.com/HewlettPackard/structex v1.0.4/go.mod h1:3frC4RY/cPsP/4+N8rkxsNAGlQwHV+zDC7qvrN+N+rE= github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20230613180840-6178f2b04900 h1:jOrP2H+D5amgHIONcucYS3/kJm6QfmqAG23Ke7elunI= diff --git a/vendor/github.com/HewlettPackard/dws/api/v1alpha2/resource_error.go b/vendor/github.com/HewlettPackard/dws/api/v1alpha2/resource_error.go index 49ba6aa8a..fdcac3588 100644 --- a/vendor/github.com/HewlettPackard/dws/api/v1alpha2/resource_error.go +++ b/vendor/github.com/HewlettPackard/dws/api/v1alpha2/resource_error.go @@ -174,6 +174,10 @@ func (e *ResourceErrorInfo) Error() string { return fmt.Sprintf("%s error: %s", strings.ToLower(string(e.Type)), message) } +func (e *ResourceErrorInfo) GetUserMessage() string { + return fmt.Sprintf("%s error: %s", string(e.Type), e.UserMessage) +} + func (e *ResourceError) SetResourceErrorAndLog(err error, log logr.Logger) { e.SetResourceError(err) if err == nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 5c84c5aa7..7546c4556 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/HewlettPackard/dws v0.0.1-0.20230815174614-998c6ad6bd1d +# github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 ## explicit; go 1.19 github.com/HewlettPackard/dws/api/v1alpha2 github.com/HewlettPackard/dws/config/crd/bases From 1a822a2229a770ed96e1ee4e4d5d70c35ae6e0eb Mon Sep 17 00:00:00 2001 From: Matt Richerson Date: Thu, 7 Sep 2023 13:18:10 -0500 Subject: [PATCH 2/2] re-vendor Signed-off-by: Matt Richerson --- go.mod | 2 +- go.sum | 4 ++-- vendor/modules.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index b66762cf5..918fc5066 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/NearNodeFlash/nnf-sos go 1.19 require ( - github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 + github.com/HewlettPackard/dws v0.0.1-0.20230907181649-2f6d9fca4249 github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20230613180840-6178f2b04900 github.com/NearNodeFlash/nnf-ec v0.0.0-20230526161255-cfb2d89b35d7 github.com/ghodss/yaml v1.0.0 diff --git a/go.sum b/go.sum index 619c1b8f6..2089d52e3 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 h1:BigoG7b53CPEkdjH2VxM0iZrgVfuzOLtEVjwPIJx/bc= -github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329/go.mod h1:YvNzcgAPmwhl/YQj6dMwsB9OpwbI5bp/41kINfFiXX8= +github.com/HewlettPackard/dws v0.0.1-0.20230907181649-2f6d9fca4249 h1:t5ibQcHcEL374lxAVVXtHqXOZbPvDVSDSrrAVl7yzBA= +github.com/HewlettPackard/dws v0.0.1-0.20230907181649-2f6d9fca4249/go.mod h1:YvNzcgAPmwhl/YQj6dMwsB9OpwbI5bp/41kINfFiXX8= github.com/HewlettPackard/structex v1.0.4 h1:RVTdN5FWhDWr1IkjllU8wxuLjISo4gr6u5ryZpzyHcA= github.com/HewlettPackard/structex v1.0.4/go.mod h1:3frC4RY/cPsP/4+N8rkxsNAGlQwHV+zDC7qvrN+N+rE= github.com/NearNodeFlash/lustre-fs-operator v0.0.1-0.20230613180840-6178f2b04900 h1:jOrP2H+D5amgHIONcucYS3/kJm6QfmqAG23Ke7elunI= diff --git a/vendor/modules.txt b/vendor/modules.txt index 7546c4556..e5a25c19d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/HewlettPackard/dws v0.0.1-0.20230907160421-5904baa06329 +# github.com/HewlettPackard/dws v0.0.1-0.20230907181649-2f6d9fca4249 ## explicit; go 1.19 github.com/HewlettPackard/dws/api/v1alpha2 github.com/HewlettPackard/dws/config/crd/bases