Skip to content

Commit 20e78d7

Browse files
committed
RHINENG-20967: don't parse empty json
1 parent 69539d4 commit 20e78d7

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
@@ -759,10 +759,12 @@ func getYumUpdates(event HostEvent, client *api.Client) (*YumUpdates, error) {
759759
}
760760

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

0 commit comments

Comments
 (0)