cleanup: return error type in stashRBDImageMetadata()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-12-08 15:09:33 +01:00 committed by mergify[bot]
parent 57ce07f54e
commit 8e589587ae

View File

@ -1097,13 +1097,13 @@ func stashRBDImageMetadata(volOptions *rbdVolume, path string) error {
encodedBytes, err := json.Marshal(imgMeta) encodedBytes, err := json.Marshal(imgMeta)
if err != nil { if err != nil {
return fmt.Errorf("failed to marshall JSON image metadata for image (%s): (%v)", volOptions, err) return fmt.Errorf("failed to marshall JSON image metadata for image (%s): %w", volOptions, err)
} }
fPath := filepath.Join(path, stashFileName) fPath := filepath.Join(path, stashFileName)
err = ioutil.WriteFile(fPath, encodedBytes, 0600) err = ioutil.WriteFile(fPath, encodedBytes, 0600)
if err != nil { if err != nil {
return fmt.Errorf("failed to stash JSON image metadata for image (%s) at path (%s): (%v)", volOptions, fPath, err) return fmt.Errorf("failed to stash JSON image metadata for image (%s) at path (%s): %w", volOptions, fPath, err)
} }
return nil return nil