Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the err message when submgr not available #1

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions convert2rhel/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ def hide_password(cmd):


def install_subscription_manager():
"""Install subscription-manager RPM and its dependencies bundled with this
tool.
"""
"""Install subscription-manager RPM and its dependencies."""
loggerinst = logging.getLogger(__name__)
sm_dir = os.path.join(utils.data_dir, "subscription-manager")
if not os.path.exists(sm_dir):
loggerinst.critical("The {0} directory does not exist. Consider using"
" the --disable-submgr option.".format(sm_dir))
if not os.path.isdir(sm_dir) or not os.listdir(sm_dir):
loggerinst.critical("The {0} directory does not exist or is empty."
" Consider using the --disable-submgr option."
" Before using it it's necessary to define a RHEL"
" repo in /etc/yum.repos.d/ and pass its repoid to"
" the convert2rhel through the --enable-repo"
" option.".format(sm_dir))
return
rpms_to_install = [os.path.join(sm_dir, x) for x in os.listdir(sm_dir)]
if rpms_to_install:
Expand Down