Foreman 2.5.2 Katello 4.1.2.1 - hammer host errata recalculate doesn't work

Problem:
hammer host errata recalculate doesn’t work on Foreman 2.5.2 + Katello 4.1.2.1

Expected outcome:
Not expecting an error, that’s for sure. If I had a working version of Katello installed, I would provide an example output.

Foreman and Proxy versions:
Foreman 2.5.2

Foreman and Proxy plugin versions:
Katello 4.1.2.1

Distribution and version:
CentOS Stream 8
Last updated on Aug 16, 2021
Active kernel 4.18.0-326.el8.x86_64

Other relevant data:

hammer host errata recalculate --host-id 46
Could not recalculate errata:
  Error: Please mention appropriate attribute value
  
  See: 'hammer host errata recalculate --help'.

I’ve verified host-id is valid and even tried name instead of id. Still doesn’t work.

@cintrix84, could you please take a look?

1 Like

@ofedoren sure I will take a look.

1 Like

@hac

It looks like the api request to Katello is working correctly, just the hammer command is not returning the results etc correctly. I can see the api request come into katello and the task complete here from looking at the production.log

2021-08-23T23:20:15 [I|app|2eaa47f5] Started PUT "/api/hosts/1/errata/applicability" for 192.168.177.129 at 2021-08-23 23:20:15 -0400
2021-08-23T23:20:15 [I|app|2eaa47f5] Processing by Katello::Api::V2::HostErrataController#applicability as JSON
2021-08-23T23:20:15 [I|app|2eaa47f5]   Parameters: {"api_version"=>"v2", "host_id"=>"1", "host_erratum"=>{}}
2021-08-23T23:20:15 [I|app|2eaa47f5] Authorized user admin(Admin User)
2021-08-23T23:20:16 [I|app|2eaa47f5]   Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.2.1/app/views/katello/api/v2/common/async.json.rabl within katello/api/v2/layouts/resource
2021-08-23T23:20:16 [I|app|2eaa47f5]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.2.1/app/views/katello/api/v2/common/async.json.rabl within katello/api/v2/layouts/resource (Duration: 1.8ms | Allocations: 2412)
2021-08-23T23:20:16 [I|app|2eaa47f5] Completed 202 Accepted in 133ms (Views: 3.8ms | ActiveRecord: 8.6ms | Allocations: 26402)
2021-08-23T23:20:16 [I|bac|d8ad8ada] Task {label: Actions::Katello::Applicability::Hosts::BulkGenerate, id: 04dc90f8-f07c-4560-a3fb-79c11324abca, execution_plan_id: fc8881cc-7c2d-41ac-957d-8d3dd4f54e24} state changed: planning
2021-08-23T23:20:16 [I|bac|d8ad8ada] Task {label: Actions::Katello::Applicability::Hosts::BulkGenerate, id: 04dc90f8-f07c-4560-a3fb-79c11324abca, execution_plan_id: fc8881cc-7c2d-41ac-957d-8d3dd4f54e24} state changed: planned
2021-08-23T23:20:16 [I|app|d8ad8ada] katello event handled success=true type=generate_host_applicability object_id=0 expired=false rescheduled=false duration=71.3
2021-08-23T23:20:16 [I|bac|d8ad8ada] Task {label: Actions::Katello::Applicability::Hosts::BulkGenerate, id: 04dc90f8-f07c-4560-a3fb-79c11324abca, execution_plan_id: fc8881cc-7c2d-41ac-957d-8d3dd4f54e24} state changed: running
2021-08-23T23:20:16 [I|bac|d8ad8ada] Task {label: Actions::Katello::Applicability::Hosts::BulkGenerate, id: 04dc90f8-f07c-4560-a3fb-79c11324abca, execution_plan_id: fc8881cc-7c2d-41ac-957d-8d3dd4f54e24} state changed: stopped  result: success
2021-08-23T23:20:16 [I|bac|d8ad8ada] Task {label: Actions::Katello::Applicability::Hosts::BulkGenerate, id: 04dc90f8-f07c-4560-a3fb-79c11324abca, execution_plan_id: fc8881cc-7c2d-41ac-957d-8d3dd4f54e24} state changed: stopped  result: success

I will take a look and see how we can get hammer fixed for you.

If I pass in --async we can see it completes ok, just does not return a task id:

Errata recalculated with task %{id}.

I will open an issue and link it here in this comment, so we can look into it further.

Here is the issue:

Bug #33327: Hammer host errata recalculate fails to display task - Katello - Foreman (theforeman.org)