Skip to content

Commit 167b074

Browse files
committed
CLOS-4056 follow-up: gate check_cl_license on is_cln_package_channel_active() + fix dead inhibitor branch
The check_cl_license actor verifies CL licensing by calling /usr/sbin/rhn_check, which under rhn-client-tools >= 3.0 does an XML-RPC roundtrip to CLN to refresh the JWT credential. On a no-auth (SWNG) system the systemid file written by clnreg_ks (2.x flow) is not in the format rhn_check 3.0+ expects against the prod CLN server, and the call dies with rhn-plugin: Error communicating with server. The message was: com.cloudlinux.clos.domain.exceptions.xmlrpc.ClnXmlRpcException: (=_=) Invalid System Credentials. Cannot parse request or identify server. Please, run registration again. elevate-qa Run #55 hit this immediately after the CLBS bundle began landing rhn-client-tools 3.0.3 source-side (now that the cln-switch-channel=2 install- time pin no longer forces a 2.x downgrade). Under no-auth, licensing is not the CLN XML-RPC roundtrip - it's IP-based (or other static mechanisms). The rhn_check route is the wrong validation here. Gate the actor on is_cln_package_channel_active() and skip when it returns False, matching the same pattern the other CLOS-4056-gated actors use (switchclnchannel, pinclnmirror, copycllicense, ...). While here, fix a pre-existing dead-code bug: `run([rhn_check_bin])` raises CalledProcessError on non-zero exit, so the `if not res or res['exit_code'] != 0 or res['stderr']: produce inhibitor` branch never executed on CLN-active failures - the actor crashed instead of producing the intended INHIBITOR report. Wrap the run() call in try/except so the existing reporting path takes over when rhn_check fails on a CLN-active system.
1 parent e89d73b commit 167b074

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

  • repos/system_upgrade/cloudlinux/actors/checkcllicense

repos/system_upgrade/cloudlinux/actors/checkcllicense/actor.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
55
from leapp.libraries.stdlib import CalledProcessError, run, api
66
from leapp.libraries.common.cllaunch import run_on_cloudlinux
7+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
78

89
from leapp.models import (
910
TargetUserSpacePreupgradeTasks,
@@ -29,10 +30,34 @@ class CheckClLicense(Actor):
2930

3031
@run_on_cloudlinux
3132
def process(self):
33+
# CLOS-4056: the rhn_check XML-RPC call only verifies licenses on
34+
# systems that use CLN as the package channel. Under no-auth (SWNG)
35+
# the license is conveyed by other means (IP-based licensing,
36+
# cloudlinux-release content) and the rhn_check round-trip is not a
37+
# meaningful gate - on rhn-client-tools 3.0+ it fails outright with
38+
# "Invalid System Credentials" against systemid files written by
39+
# clnreg_ks. Skip the check under no-auth.
40+
if not is_cln_package_channel_active():
41+
api.current_logger().info(
42+
"CLN is not the active package channel; skipping rhn_check"
43+
" license verification (no-auth systems use IP licensing,"
44+
" not the CLN XML-RPC roundtrip)."
45+
)
46+
return
47+
3248
res = None
3349
if os.path.exists(self.system_id_path):
34-
res = run([self.rhn_check_bin])
35-
self.log.debug('rhn_check result: %s', res)
50+
try:
51+
res = run([self.rhn_check_bin])
52+
self.log.debug('rhn_check result: %s', res)
53+
except CalledProcessError as e:
54+
# The original implementation assigned `res = run(...)`
55+
# bare, but `run()` raises on non-zero exit codes - so
56+
# the "produce an inhibitor on non-zero / non-empty stderr"
57+
# branch below was dead code. Catch the failure and let
58+
# the existing reporting path take over.
59+
self.log.debug('rhn_check failed: %s', e)
60+
res = None
3661
if not res or res['exit_code'] != 0 or res['stderr']:
3762
title = 'Server does not have an active CloudLinux license'
3863
summary = 'Server does not have an active CloudLinux license. This renders key CloudLinux packages ' \

0 commit comments

Comments
 (0)