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

GET request for /api/v2/hosts/:id/enc fails after adding a new interface to an existing host

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • Hosts
    • Moderate
    • No

      Description of problem:
      API operations for /api/v2/hosts/:id/enc fail after you add a new interface to an existing host.

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

      How reproducible:
      Always

      Steps to Reproduce:

      1. Have an existing host.

      2. Add a new interface, e.g:

      1. hammer host interface create --host jsenkyri-rhel9b.sysmgmt.lan --identifier test --managed false

      3. Request to fetch ENC values for the host fails:

      1. curl --request GET --insecure --user xxx:xxx https://`hostname -f`/api/v2/hosts/13/enc

        {
        "error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}

        }

      Trace from production.log:

      1. grep 77aad997 /var/log/foreman/production.log

        2024-04-23T14:21:37 [I|app|77aad997] Started GET "/api/v2/hosts/13/enc" for 10.37.195.132 at 2024-04-23 14:21:37 +0200
        2024-04-23T14:21:37 [I|app|77aad997] Processing by Api::V2::HostsController#enc as JSON
        2024-04-23T14:21:37 [I|app|77aad997] Parameters: {"apiv"=>"v2", "id"=>"13"}

        2024-04-23T14:21:37 [I|app|77aad997] Authorized user admin(Admin User)
        2024-04-23T14:21:38 [W|app|77aad997] Action failed
        2024-04-23T14:21:38 [I|app|77aad997] Backtrace for 'Action failed' error (NoMethodError): undefined method `to_export' for #<Nic::Base:0x00007f5ec1b76f48>
        77aad997 | /usr/share/gems/gems/activemodel-6.1.7.4/lib/active_model/attribute_methods.rb:469:in `method_missing'
        77aad997 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/delegation.rb:88:in `each'
        77aad997 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/relation/delegation.rb:88:in `each'
        77aad997 | /usr/share/foreman/app/models/host_info_providers/static_info.rb:56:in `map'
        77aad997 | /usr/share/foreman/app/models/host_info_providers/static_info.rb:56:in `add_network_params'
        77aad997 | /usr/share/foreman/app/models/host_info_providers/static_info.rb:13:in `host_info'
        77aad997 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `block in info'
        77aad997 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `each'
        77aad997 | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `info'
        77aad997 | /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:179:in `enc'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/abstract_controller/base.rb:228:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
        77aad997 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
        77aad997 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
        77aad997 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
        77aad997 | /usr/share/gems/gems/audited-5.3.2/lib/audited/sweeper.rb:16:in `around'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
        77aad997 | /usr/share/gems/gems/audited-5.3.2/lib/audited/sweeper.rb:16:in `around'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:137:in `run_callbacks'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/abstract_controller/callbacks.rb:41:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/notifications.rb:203:in `block in instrument'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/notifications.rb:203:in `instrument'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
        77aad997 | /usr/share/gems/gems/activerecord-6.1.7.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/abstract_controller/base.rb:165:in `process'
        77aad997 | /usr/share/gems/gems/actionview-6.1.7.4/lib/action_view/rendering.rb:39:in `process'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal.rb:190:in `dispatch'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_controller/metal.rb:254:in `dispatch'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/routing/route_set.rb:33:in `serve'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/routing/mapper.rb:49:in `serve'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/journey/router.rb:32:in `each'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/journey/router.rb:32:in `serve'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/routing/route_set.rb:842:in `call'
        77aad997 | /usr/share/gems/gems/katello-4.9.0.18/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
        77aad997 | /usr/share/gems/gems/katello-4.9.0.18/lib/katello/middleware/event_daemon.rb:10:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
        77aad997 | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/static_dispatcher.rb:68:in `call'
        77aad997 | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/extractor/recorder.rb:139:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/static.rb:24:in `call'
        77aad997 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
        77aad997 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
        77aad997 | /usr/share/gems/gems/apipie-rails-1.1.0/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/tempfile_reaper.rb:15:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/etag.rb:27:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/conditional_get.rb:27:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/head.rb:12:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
        77aad997 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:266:in `context'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:260:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/cookies.rb:697:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/callbacks.rb:98:in `run_callbacks'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
        77aad997 | /usr/share/gems/gems/railties-6.1.7.4/lib/rails/rack/logger.rb:37:in `call_app'
        77aad997 | /usr/share/gems/gems/railties-6.1.7.4/lib/rails/rack/logger.rb:28:in `call'
        77aad997 | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
        77aad997 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
        77aad997 | /usr/share/gems/gems/katello-4.9.0.18/lib/katello/prevent_json_parsing.rb:12:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/method_override.rb:24:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/runtime.rb:22:in `call'
        77aad997 | /usr/share/gems/gems/activesupport-6.1.7.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/sendfile.rb:110:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/ssl.rb:77:in `call'
        77aad997 | /usr/share/gems/gems/actionpack-6.1.7.4/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
        77aad997 | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
        77aad997 | /usr/share/gems/gems/railties-6.1.7.4/lib/rails/engine.rb:539:in `call'
        77aad997 | /usr/share/gems/gems/railties-6.1.7.4/lib/rails/railtie.rb:207:in `public_send'
        77aad997 | /usr/share/gems/gems/railties-6.1.7.4/lib/rails/railtie.rb:207:in `method_missing'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/urlmap.rb:74:in `block in call'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/urlmap.rb:58:in `each'
        77aad997 | /usr/share/gems/gems/rack-2.2.7/lib/rack/urlmap.rb:58:in `call'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/configuration.rb:270:in `call'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/request.rb:98:in `block in handle_request'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/request.rb:97:in `handle_request'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/server.rb:431:in `process_client'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/server.rb:233:in `block in run'
        77aad997 | /usr/share/gems/gems/puma-6.2.2/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
        77aad997 | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
        2024-04-23T14:21:38 [I|app|77aad997] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (Duration: 5.1ms | Allocations: 6684)
        2024-04-23T14:21:38 [I|app|77aad997] Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 8.4ms | Allocations: 13248)
        2024-04-23T14:21:38 [I|app|77aad997] Completed 500 Internal Server Error in 242ms (Views: 9.2ms | ActiveRecord: 21.4ms | Allocations: 44057)

            aruzicka@redhat.com Adam Ruzicka
            rhn-support-jsenkyri Jan Senkyrik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: