From 145b60c900b7a173d736f3af3f79b520481a1b29 Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Mon, 6 Nov 2023 17:48:00 +0100 Subject: [PATCH] RHEL-7206: Small change of message printed by dnf plugin * 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. --- src/plugins/dnf/subscription_manager.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/dnf/subscription_manager.py b/src/plugins/dnf/subscription_manager.py index 4032387b4a..38d213abf2 100644 --- a/src/plugins/dnf/subscription_manager.py +++ b/src/plugins/dnf/subscription_manager.py @@ -14,6 +14,7 @@ import os import logging +import shutil from subscription_manager import injection as inj from subscription_manager.action_client import ProfileActionClient @@ -48,6 +49,13 @@ """ ) +not_registered_warning_rhc = _( + """ +This system is not registered with an entitlement server. \ +You can use "rhc" or "subscription-manager" to register. +""" +) + no_subs_warning = _( """ This system is registered with an entitlement server, but is not receiving updates. You can use \ @@ -182,7 +190,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: