Skip to content

Commit

Permalink
CCT-66: Update identity reporting in DNF plugin during autoregistration
Browse files Browse the repository at this point in the history
* Card ID: CCT-66

During the first phase of anonymous cloud registration, the system has
valid entitlement certificates that aren't associated with any consumer.

We shouldn't be reporting missing identity. Previously this was an error
state that was not valid, but with automatic registration it is possible
to have a system consuming content that does not have an identity, for
a transition period before it is part of an anonymous or claimed
organization.
  • Loading branch information
m-horky committed Feb 6, 2024
1 parent cb18b79 commit 4820e5f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/plugins/dnf/subscription_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@

from configparser import ConfigParser

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from subscription_manager.certdirectory import EntitlementDirectory
from subscription_manager.identity import Identity


expired_warning = _(
"""
*** WARNING ***
Expand Down Expand Up @@ -137,12 +144,15 @@ def _update(cache_only):
Update entitlement certificates and redhat.repo
:param cache_only: is True, when rhsm.full_refresh_on_yum is set to 0 in rhsm.conf
"""

logger.info(_("Updating Subscription Management repositories."))

identity = inj.require(inj.IDENTITY)

if not identity.is_valid():
identity: Identity = inj.require(inj.IDENTITY)
ent_dir: EntitlementDirectory = inj.require(inj.ENT_DIR)

# During first phase of anonymous cloud registration the system has
# valid entitlement certificates, but does not yet have any identity.
# We have access to the content, so we shouldn't be reporting missing
# identity certificate.
if not identity.is_valid() and len(ent_dir.list_valid()) == 0:
logger.info(_("Unable to read consumer identity"))

if config.in_container():
Expand Down

0 comments on commit 4820e5f

Please sign in to comment.