Bug 1482502 - GET /api/hosts/:id shows errata_counts as null is errata count is zero instead of 0
Summary: GET /api/hosts/:id shows errata_counts as null is errata count is zero instea...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Errata Management
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Ales Dujicek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-17 12:37 UTC by Stanislav Tkachenko
Modified: 2019-04-01 20:27 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 17:09:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20508 0 None None None 2017-09-21 15:23:11 UTC

Description Stanislav Tkachenko 2017-08-17 12:37:51 UTC
Description of problem:
GET /api/hosts/:id shows errata_counts as integer if errata count > 0 and shows as null instead of 0 otherwise.

> GET https://sat6.com/api/v2/hosts/37
> {
> "id":37,
> ...
> "content_facet_attributes": {
>   "errata_counts": {
>     "security": 1,
>     "bugfix": null,
>     "enhancement": null,	
>     "total": 1

Version-Release number of selected component (if applicable):
Sat 6.3 Snap 11:
* satellite-6.3.0-16.0.beta.el7sat.noarch
* katello-3.4.4-2.el7sat.noarch
* foreman-1.15.3-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
To see only null values, omit steps 2 and 3.

1. Create and register content host
2. Add and synchronize repository with available errata
3. Install on the content host package that has applicable errata in the repository.
4. Check errata counts via GET /api/hosts/:id 

Actual results:
Errata count is integer if it is not zero and null oterwise.
On UI it is displayed as 0.

Expected results:
errata_counts field should contain 0.

Additional info:

Comment 1 Marek Hulan 2017-08-17 14:48:36 UTC
Please use specific components. API is for generic API request, such as new format or structure of all API responses.

Comment 3 Daniel Lobato Garcia 2017-08-22 13:59:22 UTC
Created redmine issue http://projects.theforeman.org/issues/20694 from this bug

Comment 4 Justin Sherrill 2017-09-19 18:06:27 UTC
This should be solved as part of https://bugzilla.redhat.com/show_bug.cgi?id=1491798

Moving to post for verification

Comment 5 Satellite Program 2017-09-19 18:13:40 UTC
Upstream bug assigned to jsherril

Comment 7 Bryan Kearney 2018-02-21 17:09:29 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.