Bug 1375704

Summary: Search API returns null values on set parameters
Product: Red Hat Satellite Reporter: Johan Swensson <jswensso>
Component: APIAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bkearney, jcallaha, jswensso, sabnave
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Johan Swensson 2016-09-13 19:27:39 UTC
Description of problem:
When searching for a resource via the API some variables are returned as null even tho the parameter is indeed set.

Version-Release number of selected component (if applicable):
6.2.1

How reproducible:
Every time

Steps to Reproduce:
1. Create a new host in 6.2.1
2. Look up the newly created server 
3. Search for the same server via the API




Actual results:
https://satellite.lab.example.com/api/v2/hosts/configureme.lab.example.com

{

    "ip": "192.168.180.79",
    "environment_id": 4,
    "environment_name": "KT_Default_Organization_Dev_Puppet_Modules_4",
    "last_report": "2016-09-13 16:27:29 UTC",
    "mac": "00:1a:4a:16:01:69",
    "realm_id": null,
    "realm_name": null,
    "sp_mac": null,
    "sp_ip": null,
    "sp_name": null,
    "domain_id": 1,
    "domain_name": "lab.example.com",
    "architecture_id": 1,
    "architecture_name": "x86_64",
    "operatingsystem_id": 2,
    "operatingsystem_name": "RHEL Server 7.2",
    "subnet_id": 1,
    "subnet_name": "labnet",
    "sp_subnet_id": null,
<snip>
}



https://satellite.lab.example.com/api/v2/hosts?search=configureme.lab.example.com


{

    "total": 5,
    "subtotal": 1,
    "page": 1,
    "per_page": 20,
    "search": "configureme.lab.example.com",
    "sort": {
        "by": null,
        "order": null
    },
    "results": [
        {
            "ip": null,
            "environment_id": 4,
            "environment_name": "KT_Default_Organization_Dev_Puppet_Modules_4",
            "last_report": "2016-09-13 16:27:29 UTC",
            "mac": null,
            "realm_id": null,
            "realm_name": null,
            "sp_mac": null,
            "sp_ip": null,
            "sp_name": null,
            "domain_id": null,
            "domain_name": null,
            "architecture_id": 1,
            "architecture_name": "x86_64",
            "operatingsystem_id": 2,
            "operatingsystem_name": "RHEL Server 7.2",
            "subnet_id": null,
            "subnet_name": null,
            "sp_subnet_id": null,
            "ptable_id": 103,
            "ptable_name": "vda only, all root",
            "medium_id": 9,
            "medium_name": "Default_Organization/Library/Red_Hat_Server/Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_2",
            "build": false,
            "comment": "",
            "disk": "",
            "installed_at": "2016-09-13 12:52:11 UTC",
            "model_id": 2,
            "hostgroup_id": 2,
            "owner_id": 3,
            "owner_type": "User",
            "enabled": true,
            "puppet_ca_proxy_id": 1,
            "managed": true,
            "use_image": null,
            "image_file": "",
            "uuid": "a630fdfe-6c8e-4cbc-8d36-627ffa6347b6",
            "compute_resource_id": 1,
            "compute_resource_name": "RHEV",
            "compute_profile_id": 1,
            "compute_profile_name": "1-Small",
<snip>

}


Expected results:
Values should be populated correcly when using the search API. For example, subnet_name is set to labnet in the first query. The search query should return the same value as it's the same host.


Additional info:

Comment 1 Brad Buckingham 2016-09-16 15:30:48 UTC
If using the GET on a specific host, do you see the same 'null' attributes?

Comment 2 Johan Swensson 2016-09-16 15:56:14 UTC
No, as described in the first post I see the expected values when doing a get on a specific host;

    "ip": "192.168.180.79",
    "subnet_name": "labnet",

But when searching for the same host some values return null.

     "ip": null,
     "subnet_name": null,

Worth noting is also that I see the same result when searching by mac as well as hostname.

Comment 5 Bryan Kearney 2016-09-23 12:21:59 UTC
Upstream bug assigned to szadok

Comment 6 Bryan Kearney 2016-09-23 12:22:03 UTC
Upstream bug component is API

Comment 7 Bryan Kearney 2016-09-23 12:22:06 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16380 has been resolved.

Comment 9 Peter Ondrejka 2016-11-22 11:25:12 UTC
Verified in Satellite 6.3, snap 6, parameters no longer missing in the search output.

Comment 11 Satellite Program 2018-02-21 16:54:17 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