Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-33243

hammer insights inventory sync raises an ISE

XMLWordPrintable

    • None
    • None
    • None
    • None

      Description of problem:

       

      # hammer insights inventory sync --organization-id=13
      Error: undefined method `[]' for nil:NilClass

      This occurs if the organization has no hosts to sync. The server correctly returns a 400 error. Just that hammer is unable to show the correct message

       

      How reproducible:

      Always

      Is this issue a regression from an earlier version:

      No

      Steps to Reproduce:

      1. Latest stream snap

      2. 

      # hammer insights inventory sync --organization-id=13

      3.

      Actual behavior:

      Error: undefined method `[]' for nil:NilClass

      Expected behavior:

       

      Nothing to sync, there are no hosts with subscription for this organization."
      

       

      Business Impact / Additional info:

      More details from hammer -d

       

       [ INFO 2025-04-23T23:15:27 API] Server: https://ip-10-0-167-143.rhos-01.prod.psi.rdu2.redhat.com
      [ INFO 2025-04-23T23:15:27 API] POST /api/organizations/13/rh_cloud/inventory_sync
      [DEBUG 2025-04-23T23:15:27 API] Params: {}
      [DEBUG 2025-04-23T23:15:27 API] Headers: {}
      [DEBUG 2025-04-23T23:15:27 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
      [ERROR 2025-04-23T23:15:28 API] 400 Bad Request
      [DEBUG 2025-04-23T23:15:28 API] {
          "message" => "ERF74-6085 [InventoryUpload::TaskActions::NothingToSyncError]: Nothing to sync, there are no hosts with subscription for this organization."
      }
      [DEBUG 2025-04-23T23:15:28 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_bad_request
      [DEBUG 2025-04-23T23:15:28 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
      [ERROR 2025-04-23T23:15:28 Exception] Error: undefined method `[]' for nil:NilClass
      Error: undefined method `[]' for nil:NilClass
      [ERROR 2025-04-23T23:15:28 Exception] 
      NoMethodError (undefined method `[]' for nil:NilClass):
          /usr/share/gems/gems/hammer_cli_foreman-3.15.0.pre.develop/lib/hammer_cli_foreman/exception_handler.rb:173:in `response_message'
          /usr/share/gems/gems/hammer_cli_foreman-3.15.0.pre.develop/lib/hammer_cli_foreman/exception_handler.rb:113:in `handle_bad_request'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/exception_handler.rb:31:in `handle_exception'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/messages.rb:26:in `handle_exception'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/abstract.rb:107:in `rescue in run'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/abstract.rb:102:in `run'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/abstract.rb:103:in `run'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/abstract.rb:103:in `run'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/lib/hammer_cli/abstract.rb:103:in `run'
          /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:140:in `run'
          /usr/share/gems/gems/hammer_cli-3.15.0.pre.develop/bin/hammer:142:in `<top (required)>'
          /usr/bin/hammer:25:in `load'
          /usr/bin/hammer:25:in `<main>'
      

       

       

       

              rhn-engineering-lfu Lucy Fu
              rhn-engineering-paji Partha Aji
              Cole Higgins Cole Higgins
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: