Skip to content

Commit aba1d00

Browse files
committed
RHINENG-20967: don't parse empty json
1 parent a0c69b2 commit aba1d00

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

listener/upload.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,12 @@ func getYumUpdates(event HostEvent, client *api.Client) (*YumUpdates, error) {
760760
}
761761

762762
if (parsed == vmaas.UpdatesV3Response{}) {
763-
utils.LogWarn("yum_updates_s3url", yumUpdatesURL, "No yum updates on S3, getting legacy yum_updates field")
764-
err := sonic.Unmarshal(yumUpdates, &parsed)
765-
if err != nil {
766-
return nil, errors.Wrap(err, "unable to unmarshall yum updates")
763+
utils.LogDebug("yum_updates_s3url", yumUpdatesURL, "No yum updates on S3, getting legacy yum_updates field")
764+
if len(yumUpdates) > 0 { // yumUpdates are not empty
765+
err := sonic.Unmarshal(yumUpdates, &parsed)
766+
if err != nil {
767+
return nil, errors.Wrap(err, "unable to unmarshall yum updates")
768+
}
767769
}
768770
}
769771

0 commit comments

Comments
 (0)