Problem:
On a fresh install of Foreman / Katello, the first system I registered failed with the following error. A subsequent registration succeeded, but now I have two RHEL licenses consumed and only one system registered. I need to now release the orphaned license consumption that resulted as a failure of the first registration not succeeding.
subscription-manager register --org=my-org --activationkey=rhel7-with-openresty
HTTP error (500 - Internal Server Error): PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index_operatingsystems_on_title”
DETAIL: Key (title)=(RedHat 7.7) already exists.
: INSERT INTO “operatingsystems” (“major”, “name”, “minor”, “created_at”, “updated_at”, “type”, “title”) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING “id”
WARNING
This system has already been registered with Red Hat using RHN Classic.
Your system is being registered again using Red Hat Subscription Management. Red Hat recommends that customers only register once.
To learn how to unregister from either service please consult this Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
Expected outcome:
Registrations should not fail on a fresh install of Foreman. If they do, RHEL licenses should not be consumed.
Foreman and plugin versions:
Foreman 1.24.0
Katello 3.14.0
foreman-tasks 0.17.5
Distribution and version:
RHEL 7.7
Other relevant data: