How to clear "Non-security errata installable" warning from CLI

In our environment, we install security and bugfix errata on our servers every month. This results in all of our servers constantly being in a warning state from “Non-security errata installable.” This can be cleared from the GUI, but is there a way to do this programmatically from the CLI?

I’ve discovered I can do this via the Foreman Postgres database, using either of these commands:

update host_status set status = 0 where type='Katello::ErrataStatus' and status = 2;

or

delete from host_status where type='Katello::ErrataStatus' and status = 2;

Normally I avoid mucking with app databases directly whenever possible. Are either of these a horrible idea, or is it fine, or is there a better way?

I think you should be able to do this with hammer host status but I don’t know the exact command…

I don’t think that function is available in hammer. There is an forget_status API: API documentation

As far as I’ve been able to tell, both hammer host status and the API to clear status only works for the build and configuration statuses, not any of the other sub-statuses like Katello::ErrataStatus.

To clear my errata status from the web UI, I first loaded up the host details page. It sent a GET request to /hosts/<fqdn>/statuses. It got back a response like

[{id: 1, name: "Subscription", label: "Simple Content Access", link: null, global: 0, status: 5,…},…]
{id: 1, name: "Subscription", label: "Simple Content Access", link: null, global: 0, status: 5,…}
{id: 2, name: "Errata", label: "Security errata applicable", link: null, global: 2, status: 3,…}
{id: 4, name: "Execution", label: "Last execution succeeded", link: "/job_invocations/1", global: 0,…}

When I actually cleared the errata status and clicked confirm, it sent a POST request to /hosts/<fqdn>/forget_status?status=2.

So it appears it uses the status ID to clear them.

@brgerig Did you find solution? I have the same problem