How is errata applicability recalculated? how can I automate that the errata applicability is recalculated in a regular basis?

Hi all,

I am using foreman 1.16 with katello 3.5.0 to manage centos7 hosts.

I have deployed this script to insert the CentOS errata information into katello and this is working ok. I can see the available errata, apply it…etc

The problem I have is that for each new deployed server when the server appears in hosts >> all hosts it says:

Errata Could not calculate errata status, ensure host is registered and katello-agent is installed

For the same server, when I go to hosts >> content hosts it says
Subscription Status Fully entitled
Katello Agent Installed

I have double checked that goferd daemon is running in the machine and I can use the foreman webui to install new rpms to the centos server.

The only way I found to workaround the issue is going in the webui to hosts >> content hosts >> hostname >> errata >> recalculate . After I trigger the errata recalculate from the webui the issue is fixed but this doesn’t seem a proper solution for all our hosts.

Trying to find a solution which allows me to trigger the errata recalculation in an automated way I have tried to execute katello-tracer-upload, katello-package-upload and subscription-manager refresh in the centos server running the katello agent but this doesn’t fix the problem.

This is what I get in /var/log/foreman/production.log in the foreman server when I execute katello-tracer-upload in the client:

2018-03-02 20:00:10 ac35f9c3 [app] [I] Started GET "/rhsm/" for at 2018-03-02 20:00:10 +0100
2018-03-02 20:00:10 ac35f9c3 [app] [I] Processing by Katello::Api::V2::RootController#rhsm_resource_list as JSON
2018-03-02 20:00:10 ac35f9c3 [app] [I]   Parameters: {"root"=>{}}
2018-03-02 20:00:10 ac35f9c3 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello- within katello/api/v2/layouts/collection (1.6ms)
2018-03-02 20:00:10 ac35f9c3 [app] [I] Completed 200 OK in 18ms (Views: 9.7ms | ActiveRecord: 0.0ms)

This is what I get in /var/log/foreman/production.log in the foreman server when I execute katello-package-upload in the client:

2018-03-02 20:01:32 0781717c [app] [I] Started GET "/rhsm/" for at 2018-03-02 20:01:32 +0100
2018-03-02 20:01:32 0781717c [app] [I] Processing by Katello::Api::V2::RootController#rhsm_resource_list as JSON
2018-03-02 20:01:32 0781717c [app] [I]   Parameters: {"root"=>{}}
2018-03-02 20:01:32 0781717c [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello- within katello/api/v2/layouts/collection (1.4ms)
2018-03-02 20:01:32 0781717c [app] [I] Completed 200 OK in 10ms (Views: 2.2ms | ActiveRecord: 0.0ms)

This is what I get in /var/log/foreman/production.log in the foreman server when I execute subscription-manager refresh in the client:

2018-03-02 20:03:54 c0760d2c [app] [I] Started PUT "/rhsm/consumers/9ea34f57-8c2d-4f0d-8fbe-583f157fb316/certificates?lazy_regen=true" for at 2018-03-02 20:03:54 +0100
2018-03-02 20:03:54 c0760d2c [app] [I] Processing by Katello::Api::Rhsm::CandlepinProxiesController#put as JSON
2018-03-02 20:03:54 c0760d2c [app] [I]   Parameters: {"lazy_regen"=>"true", "id"=>"9ea34f57-8c2d-4f0d-8fbe-583f157fb316"}
2018-03-02 20:03:54 c0760d2c [app] [I] Current user: 9ea34f57-8c2d-4f0d-8fbe-583f157fb316 (regular user)
2018-03-02 20:03:54 c0760d2c [app] [I] Completed 200 OK in 50ms (Views: 0.3ms | ActiveRecord: 0.8ms)

None of these solves the issue. I have checked in monitor >> tasks in the foreman webui that there are no pending or failed tasks.

I have also checked if the hammer cli provides any option to trigger the errata recalculation but it only allows hammer erratum info and hammer erratum list

Is there any way I can automate the errata recalculation in a regular basis for all my content hosts without going to the webui?

Thanks in advance for any help or suggestion.

I have also tried to resync all my yum repos to check if this would trigger the errata applicability recalculation but it didn’t

I have tried to run my config manager (ansible) in this host but this doesn’t solve the issue neither. When the ansible execution completes it uses the callback to report foreman about the proper execution and in “hosts >> all hosts >> hostname” I get:

Configuration Active

but for this host I still have:

Errata Could not calculate errata status, ensure host is registered and katello-agent is installed

I have also found that hammer provides the option “hammer host errata” but this doesn’t seem to provide the functionality to recalculate the errata:

# hammer host errata -h
    hammer host errata [OPTIONS] SUBCOMMAND [ARG] ...

 SUBCOMMAND                    subcommand
 [ARG] ...                     subcommand arguments

 apply                         Schedule errata for installation
 info                          Retrieve a single errata for a host
 list                          List errata available for the content host

I have seen that the katello API provides the functionality to regenerate applicability.

I think I will try to write a short script to query the API for the list of hosts and then trigger the regeneration of applicability for each of them using the API.

Is this really the only way to do it besides using the webui? Or am I missing something obvious?

Any help or suggestion is much appreciated.

1 Like

Perhaps someone from @katello team can chime in?


I think I could finally solve the problem.

I was using katello 3.5.0 with some downgraded qpid packages because I was hitting this bug

Today I decided to upgrade my katello server to the latest katello-3.5.1 and after applying the upgrade and rebooting the server the problem seems to be solved. I cannot assure if the problem was with 3.5.0 or the upgrade procedure triggered some modification that fixed it. Anyway now it seems to work :slight_smile: For each new deployed machine the errata applicability is automatically recalculated.

The only issue I am hitting now is that when the new deployed machine boots for the first time I get this in “hosts >> all hosts >> hostname”

Status	Error
Traces	Reboot required

If I go to “hosts >> content hosts >> hostname >> traces” I get:

anaconda	session	You will have to log out & log in again
anaconda-shell@hvc0	daemon	systemctl restart anaconda-shell@hvc0
anaconda-shell@hvc1	daemon	systemctl restart anaconda-shell@hvc1
chronyd	daemon	systemctl restart chronyd
dbus	static	You will have to reboot your computer
kernel	static	You will have to reboot your computer
lvm2-lvmetad	daemon	systemctl restart lvm2-lvmetad
multipathd	daemon	systemctl restart multipathd
NetworkManager	daemon	systemctl restart NetworkManager
polkit	daemon	systemctl restart polkit
rsyslog	daemon	systemctl restart rsyslog
systemd	static	You will have to reboot your computer
systemd-journald	daemon	systemctl restart systemd-journald
systemd-logind	daemon	systemctl restart systemd-logind
systemd-udevd	daemon	systemctl restart systemd-udevd

This problem is only solved if I login to the server and I manually execute “katello-tracer-upload”

I have verified that there is a cron file “/etc/cron.d/katello-host-tools” which should execute “katello-tracer-upload” after reboot. I also tried to modify my provisioning template to add “katello-tracer-upload” to “/etc/rc.local” but none of these solved the problem. The only workaround is to manually execute “katello-tracer-upload” or install a package with yum which triggers the executing of “katello-tracer-upload” after the installation.

I reported this problem here. Any suggestion about how to solve or debug it is much appreciated.

Found out how to force the package upload + errata recalculation:
/usr/sbin/katello-package-upload -f

Or, in case you are having a older version of the katello-agent:
rm /var/lib/rhsm/packages/packages.json