Bug 1329561 - with 2000 systems registered, hammer often/always complains "Expect initializer to return hash if a group of attributes is defined by lazy_accessor"
Summary: with 2000 systems registered, hammer often/always complains "Expect initializ...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.2.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-22 08:58 UTC by Jan Hutař
Modified: 2022-03-13 14:02 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-16 13:40:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2016-04-22 08:58:25 UTC
Description of problem:
With 2000 systems registered, hammer often/always complains "Expect initializer to return hash if a group of attributes is defined by lazy_accessor"


Version-Release number of selected component (if applicable):
satellite-6.2.0-8.2.beta.el7sat.noarch
tfm-rubygem-hammer_cli-0.6.1-1.el7.noarch


How reproducible:
often to always


Steps to Reproduce:
1. Have Sat with 2000 content hosts registered
2. # grep timeout /etc/hammer/cli.modules.d/foreman.yml
   # API request timeout. Set to -1 for no timeout
   #:request_timeout: 120 #seconds
   :request_timeout: -1
3. # hammer -u admin -p changeme content-host list --organization-id 1


Actual results:
Expect initializer to return hash if a group of attributes is defined by lazy_accessor


Expected results:
Should give me list of content hosts


Additional info:
# hammer -dv -u admin -p changeme content-host list --organization-id 1
[ INFO 2016-04-22 04:56:52 Init] Initialization of Hammer CLI (0.6.1) has started...
[DEBUG 2016-04-22 04:56:52 Init] Running at ruby 2.2.2-p95
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2016-04-22 04:56:52 Init] Configuration from the file /root/.hammer/cli_config.yml has been loaded
[DEBUG 2016-04-22 04:56:53 Connection] Registered: foreman
[DEBUG 2016-04-22 04:56:53 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[DEBUG 2016-04-22 04:56:53 API] Follow redirects: default
[ INFO 2016-04-22 04:56:53 Modules] Extension module hammer_cli_foreman (0.6.2) loaded
[ INFO 2016-04-22 04:56:53 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded
[ INFO 2016-04-22 04:56:53 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2016-04-22 04:56:53 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2016-04-22 04:56:53 Modules] Extension module hammer_cli_gutterball (1.0.1) loaded
[ INFO 2016-04-22 04:56:53 Modules] Extension module hammer_cli_import (0.10.23) loaded
[ INFO 2016-04-22 04:56:53 Modules] Extension module hammer_cli_katello (0.0.22.6) loaded
[DEBUG 2016-04-22 04:56:53 Init] Using locale 'en'
[DEBUG 2016-04-22 04:56:53 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.1/locale'
[DEBUG 2016-04-22 04:56:53 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.2/locale'
[DEBUG 2016-04-22 04:56:53 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2016-04-22 04:56:53 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.6/locale'
[ INFO 2016-04-22 04:56:53 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ WARN 2016-04-22 04:56:53 HammerCLIKatello::ContentHostCommand::AvailableIncrementalUpdates] Resource 'systems_bulk_actions' does not exist in the API
[ INFO 2016-04-22 04:56:53 HammerCLIKatello::ContentHostCommand] Called with options: {}
[ INFO 2016-04-22 04:56:53 HammerCLIKatello::ContentHostCommand::ListCommand] Called with options: {"option_organization_id"=>1}
[ INFO 2016-04-22 04:56:53 API] Server: https://<fqdn>
[ INFO 2016-04-22 04:56:53 API] GET /katello/api/organizations/1/systems
[DEBUG 2016-04-22 04:56:53 API] Params: {
        "page" => 1,
    "per_page" => 1000,
        "sort" => {}
}
[DEBUG 2016-04-22 04:56:53 API] Headers: {
    :params => {
            "page" => 1,
        "per_page" => 1000,
            "sort" => {}
    }
}
[DEBUG 2016-04-22 04:56:59 API] 500 Internal Server Error
{
    "displayMessage" => "Expect initializer to return hash if a group of attributes is defined by lazy_accessor",
            "errors" => [
        [0] "Expect initializer to return hash if a group of attributes is defined by lazy_accessor"
    ]
}
[ERROR 2016-04-22 04:56:59 Exception] Expect initializer to return hash if a group of attributes is defined by lazy_accessor
Expect initializer to return hash if a group of attributes is defined by lazy_accessor
[ERROR 2016-04-22 04:56:59 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.6.1/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.2/lib/hammer_cli_foreman/commands.rb:189:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.2/lib/hammer_cli_foreman/commands.rb:279:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.2/lib/hammer_cli_foreman/commands.rb:314:in `retrieve_all'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.2/lib/hammer_cli_foreman/commands.rb:298: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.6.1/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.6.1/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.6.1/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.6.1/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 2 Tomas Strachota 2016-07-26 13:15:42 UTC
Changing the component to Hosts since the problem occurred on server side. It's most likely caused by group initializer for values from candlepin returning nil instead of Hash for one of the hosts.

Jan, can you please attach foreman-debug next time you encounter this issue?

Comment 5 Ivan Necas 2017-01-03 13:10:03 UTC
Seems to be somehow connected to https://bugzilla.redhat.com/show_bug.cgi?id=1409795, perhaps when accessing a host record that has not uuid specified yet

Comment 6 Justin Sherrill 2017-01-04 18:35:00 UTC
The content-hosts (systems) api no longer exists in master upstream, and I cannot reproduce on the hosts api.  The /hosts index api does not hit candlepin at all, and when accessing  /hosts/:id, i get:

RestClient::ResourceNotFound: Katello::Resources::Candlepin::CandlepinResource: 404 Resource Not Found {"displayMessage":"Runtime Error Could not find resource for relative : /consumers//compliance of full path: https://robot.example.com:8443/candlepin/consumers//compliance 

which is a bit different.

We could try to fix the systems api to better handle this case, but given the minor nature of the content-hosts api in 6.2, the fact no customers have filed an issue about this particular issue, and the fact its already resolved upstream I'm more inclined to close as WONTFIX.

Another option would be to handle this scenario as part of the hosts show api so that it does not return an error, but simply returns no subscription information.

Comment 7 Brad Buckingham 2017-03-16 13:40:23 UTC
Based upon comment 6, I am going to close:wontfix this bugzilla.  As noted, the correct API/CLI to use in 6.2. is host vs system/content-host.  The content-host/systems have been deprecated, removed from the upstream and will no longer exist in 6.3.


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