Skip to content

Commit

Permalink
RHEL-7206: Small change of message printed by dnf plugin
Browse files Browse the repository at this point in the history
* When system is not registered, then we print hint how to
  register the system. We mention only "subscription-manager",
  but there is no information about "rhc", when "rhc" is
  installed.
* This patch adds "rhc" to this message.
* When "rhc" is not installed, then original message is
  displayed.
  • Loading branch information
jirihnidek committed Nov 6, 2023
1 parent 425aa7c commit 1ee857c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/plugins/dnf/subscription_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import os
import logging
import shutil

from subscription_manager import injection as inj
from subscription_manager.action_client import ProfileActionClient
Expand Down Expand Up @@ -48,6 +49,12 @@
"""
)

not_registered_warning_rhc = _(
"""
This system is not registered with an entitlement server. You can use "rhc" or "subscription-manager" to register.

Check failure on line 54 in src/plugins/dnf/subscription_manager.py

View workflow job for this annotation

GitHub Actions / black & flake8 & rpmlint

E501 line too long (114 > 110 characters)
"""
)

no_subs_warning = _(
"""
This system is registered with an entitlement server, but is not receiving updates. You can use \
Expand Down Expand Up @@ -182,7 +189,10 @@ def _warn_or_give_usage_message():
ent_dir = inj.require(inj.ENT_DIR)
# Don't warn people to register if we see entitlements, but no identity:
if not identity.is_valid() and len(ent_dir.list_valid()) == 0:
msg = not_registered_warning
if shutil.which("rhc") is not None:
msg = not_registered_warning_rhc
else:
msg = not_registered_warning
elif len(ent_dir.list_valid()) == 0 and not is_simple_content_access(identity=identity):
msg = no_subs_warning
finally:
Expand Down

0 comments on commit 1ee857c

Please sign in to comment.