Bug 1416690

Summary: hammer errata list for satellite host throws error: NoMethodError: undefined method `installable_errata' for nil:NilClass
Product: Red Hat Satellite Reporter: Oleksandr Shtaier <oshtaier>
Component: Content ManagementAssignee: Walden Raines <walden>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.7CC: bbuckingham, bkearney, kbidarka, lpramuk, omaciel, oshtaier, rnuccite, sghai, walden
Target Milestone: UnspecifiedKeywords: AutomationBlocker, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: http://projects.theforeman.org/issues/15564
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1351040 Environment:
Last Closed: 2018-02-21 16:51:07 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:
Embargoed:
Bug Depends On: 1351040    
Bug Blocks:    

Description Oleksandr Shtaier 2017-01-26 09:21:34 UTC
Description of problem: I was just trying to list errata for all hosts and its working fine. But when I checked the errata list for satellite host itself, it failed to list with below error:

 ~]# hammer -u admin -p changeme host list
---|--------------------------------------------|------------------|------------|---------------|------------------
ID | NAME                                       | OPERATING SYSTEM | HOST GROUP | IP            | MAC              
---|--------------------------------------------|------------------|------------|---------------|------------------
1  | cloud-qe-06.idmqe.lab.eng.bos.redhat.com   | RHEL Server 6.8  |            | 10.19.34.35   | 34:40:b5:8a:43:ff


[root@cloud-qe-06 ~]# hammer -u admin -p changeme host errata list  --host-id 1
undefined method `installable_errata' for nil:NilClass


Please note that "--host-id 1" is of satellite server's itself.

Version-Release number of selected component (if applicable):
sat6.2 GA snap17

How reproducible:
always

Steps to Reproduce:
1. hammer -u admin -p changeme host errata list  --host-id <id_of_satellite_server_host>
2.
3.

Actual results:
[root@cloud-qe-06 ~]# hammer -u admin -p changeme host errata list  --host-id 1
undefined method `installable_errata' for nil:NilClass

Expected results:
no exception

Additional info:

[DEBUG 2016-06-29 01:43:18 API] 500 Internal Server Error
{
    "displayMessage" => "undefined method `installable_errata' for nil:NilClass",
            "errors" => [
        [0] "undefined method `installable_errata' for nil:NilClass"
    ]
}
[ERROR 2016-06-29 01:43:18 Exception] undefined method `installable_errata' for nil:NilClass
undefined method `installable_errata' for nil:NilClass
[ERROR 2016-06-29 01:43:18 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:308:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:295:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:224:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:174:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:169:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/resource.rb:14:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.8/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.8/lib/hammer_cli_foreman/commands.rb:280:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.8/lib/hammer_cli_foreman/commands.rb:303:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.10/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 1 Oleksandr Shtaier 2017-01-26 09:22:25 UTC
Reproduced on 6.2.7

Comment 3 Satellite Program 2017-01-26 11:05:44 UTC
Upstream bug assigned to walden

Comment 4 Satellite Program 2017-01-26 11:05:49 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/15564 has been resolved.

Comment 5 Kedar Bidarkar 2017-09-10 20:29:42 UTC
[root@qe-sat6 ~]# hammer -u admin -p changeme host list
---|-----------------------------------------------------|------------------|-------------------------|------------|-------------------|--------------|----------------------
ID | NAME                                                | OPERATING SYSTEM | HOST GROUP              | IP         | MAC               | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|-----------------------------------------------------|------------------|-------------------------|------------|-------------------|--------------|----------------------
5  | faye-saeturn.domain.redhat.com          | RedHat 7.4       | RHEL 7 Server 64-bit HG | 10.x.x.7 | 00:1a:4a:3e:a6:2e | RHEL 7 CV    | DEV                  
1  | qe-sat6.domain.redhat.com | RedHat 7.4       |                         | 10.x.x.1 | 52:54:00:32:9e:c6 | RHEL 7 CV    | DEV                  
---|-----------------------------------------------------|------------------|-------------------------|------------|-------------------|--------------|----------------------

[root@qe-sat6 ~]# hammer -u admin -p changeme host errata list --host-id 1
---|------------|------|-------|------------
ID | ERRATUM ID | TYPE | TITLE | INSTALLABLE
---|------------|------|-------|------------


[root@qe-sat6 ~]# hammer -u admin -p changeme host info --id 1
Id:                       1
Name:                     qe-sat6.domain.redhat.com
Organization:             Default Organization
Location:                 Default Location
Environment:              production
Puppet CA Id:             1
Puppet Master Id:         1
Cert name:                qe-sat6.domain.redhat.com
Managed:                  no
Installed at:             
Last report:              2017/09/10 20:09:23
Network:                  
    IP:     10.x.x.1
    MAC:    52:54:00:32:9e:c6
    Domain: domain.redhat.com
Network interfaces:       
 1) Id:          1
    Identifier:  eth0
    Type:        interface (primary, provision)
    MAC address: 52:54:00:32:9e:c6
    IP address:  10.x.x.1
    FQDN:
Operating system:         
    Architecture:           x86_64
    Operating System:       RedHat 7.4
    Build:                  no
    Custom partition table:
Parameters:               

Additional info:          
    Owner Id:   1
    Owner Type: User
    Enabled:    yes
    Model:      Standard PC (i440FX + PIIX, 1996)
    Comment:
Content Information:      
    Content View:          RHEL 7 CV
    Lifecycle Environment: DEV
    Applicable Packages:   0
    Upgradable Packages:   0
    Applicable Errata:     
        Enhancement: 
        Bug Fix:     
        Security:
Subscription Information: 
    UUID:                          0af4e40d-0f44-498a-bcda-d2cceff7396b
    Last Checkin:                  2017-09-10 20:19:22 UTC
    Service Level:                 
    Release Version:               
    Autoheal:                      true
    Registered At:                 2017-09-10 20:19:16 UTC
    Registered by Activation Keys: 
     1) ak-rhel-7
Host Collections:
-------------------------

No, error seen when running hammer errata list, for satellite host.


VERIFIED with Sat6.3.0-snap15.0

Comment 6 Satellite Program 2018-02-21 16:51:07 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