Skip to content

Commit d7eb996

Browse files
committed
CLOS-4056: clarify CLN detection — package channel vs registration
The first commit on this branch named the helper is_cln_configured() and the actor comments said things like 'CLN is not configured here'. That conflated two separate concerns and was misleading: CLN registration is still in use on no-auth (SWNG) systems for licensing and inventory — what the no-auth migration changes is only the package channel (the spacewalk DNF plugin no longer delivers packages from a CLN channel). Rename: is_cln_configured() -> is_cln_package_channel_active() so the function name reflects what the actors actually need to gate on, and rewrite its docstring + module header to spell out the package-channel vs registration distinction. Update each of the five actor comments accordingly. The detection logic itself is unchanged — registration state plus a non-disabled spacewalk plugin remains the right heuristic for 'CLN is delivering packages'. Tests updated to match the new name and to phrase scenarios in terms of the channel rather than 'CLN configured'.
1 parent 1aafb73 commit d7eb996

7 files changed

Lines changed: 92 additions & 57 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from leapp.reporting import Report
55
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
66
from leapp.libraries.common.cllaunch import run_on_cloudlinux
7-
from leapp.libraries.common.cln_detect import is_cln_configured
7+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
88

99

1010
class CheckRhnVersionOverride(Actor):
@@ -19,8 +19,12 @@ class CheckRhnVersionOverride(Actor):
1919

2020
@run_on_cloudlinux
2121
def process(self):
22-
if not is_cln_configured():
23-
# CLOS-4056: no-auth systems have no CLN config to inspect.
22+
if not is_cln_package_channel_active():
23+
# CLOS-4056: versionOverride only matters when CLN is delivering
24+
# packages — the upgrade rewrites it to drive channel selection.
25+
# On no-auth (SWNG) systems the package channel is cl-channel,
26+
# not CLN, so there is nothing to inspect or warn about even if
27+
# /etc/sysconfig/rhn/up2date is still present from registration.
2428
return
2529

2630
up2date_config = '/etc/sysconfig/rhn/up2date'

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from leapp.actors import Actor
55
from leapp.libraries.stdlib import api
66
from leapp.libraries.common.cllaunch import run_on_cloudlinux
7-
from leapp.libraries.common.cln_detect import is_cln_configured
7+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
88
from leapp.libraries.common.cln_switch import get_target_userspace_path
99
from leapp.tags import DownloadPhaseTag, IPUWorkflowTag
1010
from leapp.libraries.common.config.version import get_target_major_version
@@ -26,10 +26,13 @@ class PinClnMirror(Actor):
2626
@run_on_cloudlinux
2727
def process(self):
2828
"""Pin CLN mirror"""
29-
if not is_cln_configured():
30-
# CLOS-4056: no-auth systems don't use CLN mirrors; skip cleanly.
29+
if not is_cln_package_channel_active():
30+
# CLOS-4056: pinning the CLN mirror is only meaningful when CLN
31+
# is delivering packages. On no-auth (SWNG) systems packages come
32+
# from cl-channel via mirrorlist, so there is nothing to pin —
33+
# registration may still be in place but is irrelevant here.
3134
api.current_logger().info(
32-
"CLN is not configured on this system; skipping mirror pinning"
35+
"CLN is not the active package channel; skipping mirror pinning"
3336
)
3437
return
3538

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from leapp.libraries.stdlib import api
33
from leapp.tags import FinalizationPhaseTag, IPUWorkflowTag
44
from leapp.libraries.common.cllaunch import run_on_cloudlinux
5-
from leapp.libraries.common.cln_detect import is_cln_configured
5+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
66

77

88
class ResetRhnVersionOverride(Actor):
@@ -17,8 +17,11 @@ class ResetRhnVersionOverride(Actor):
1717

1818
@run_on_cloudlinux
1919
def process(self):
20-
if not is_cln_configured():
21-
# CLOS-4056: no-auth systems have no CLN config to reset.
20+
if not is_cln_package_channel_active():
21+
# CLOS-4056: versionOverride is only set/used by the CLN package
22+
# channel flow. If the system isn't on CLN for packages, leave
23+
# /etc/sysconfig/rhn/up2date alone — registration metadata there
24+
# is not ours to touch.
2225
return
2326

2427
up2date_config = '/etc/sysconfig/rhn/up2date'

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
44
from leapp.libraries.stdlib import CalledProcessError
55
from leapp.libraries.common.cllaunch import run_on_cloudlinux
6-
from leapp.libraries.common.cln_detect import is_cln_configured
6+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
77
from leapp.libraries.common.cln_switch import cln_switch
88
from leapp import reporting
99
from leapp.reporting import Report
@@ -23,22 +23,24 @@ class SwitchClnChannel(Actor):
2323

2424
@run_on_cloudlinux
2525
def process(self):
26-
if not is_cln_configured():
27-
# CLOS-4056: No-auth (SWNG) systems have no CLN plumbing. Skipping
28-
# the channel switch here is correct — the system receives CL9
29-
# packages via cl-channel / cloudlinux9-baseos instead.
26+
if not is_cln_package_channel_active():
27+
# CLOS-4056: CLN is no longer the package channel here (no-auth /
28+
# SWNG mode). Skipping the channel switch is correct — packages
29+
# come from cl-channel / cloudlinux9-baseos instead. The system
30+
# may still be CLN-registered for licensing; that is a separate
31+
# concern this actor does not need to manage.
3032
api.current_logger().info(
31-
"CLN is not configured on this system; skipping channel switch"
33+
"CLN is not the active package channel; skipping channel switch"
3234
)
3335
return
3436

3537
try:
3638
cln_switch(target=int(get_target_major_version()))
3739
except CalledProcessError as e:
38-
# CLOS-4056: Do not inhibit. CLN may be partially configured (legacy
39-
# registration files present but no working registration) on systems
40-
# transitioning to the no-auth scheme, and a failed channel switch
41-
# there is expected — the no-auth repos still serve CL9 packages.
40+
# CLOS-4056: Do not inhibit. Even on systems that ARE using CLN
41+
# as the package channel, a transient CLN-server reachability
42+
# problem at FirstBoot (DNS/network not up yet) shouldn't block
43+
# the upgrade — the no-auth fallback repos still serve packages.
4244
reporting.create_report(
4345
[
4446
reporting.Title(

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from leapp.actors import Actor
44
from leapp.libraries.common.cllaunch import run_on_cloudlinux
5-
from leapp.libraries.common.cln_detect import is_cln_configured
5+
from leapp.libraries.common.cln_detect import is_cln_package_channel_active
66
from leapp.libraries.common.cln_switch import get_target_userspace_path
77
from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
88

@@ -20,8 +20,10 @@ class UnpinClnMirror(Actor):
2020

2121
@run_on_cloudlinux
2222
def process(self):
23-
if not is_cln_configured():
24-
# CLOS-4056: pinclnmirror was skipped on no-auth systems, nothing to unpin.
23+
if not is_cln_package_channel_active():
24+
# CLOS-4056: pinclnmirror skipped its work for the same reason
25+
# (CLN is not the package channel here), so there is nothing
26+
# for us to unpin.
2527
return
2628

2729
target_userspace = get_target_userspace_path()

repos/system_upgrade/cloudlinux/libraries/cln_detect.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
"""Detection helpers for CLN (CloudLinux Network / Spacewalk) state.
1+
"""Detection helpers for the CloudLinux Network (CLN) package channel.
22
3-
A system is considered to have CLN *configured* when it has registration
4-
state plus the spacewalk DNF/YUM plugin installed and not explicitly
5-
disabled. Systems that have been migrated to the no-auth (SWNG mirrorlist)
6-
scheme have either:
3+
CLN has historically combined two concerns:
74
8-
- no `/etc/sysconfig/rhn/systemid` (never registered or deregistered),
9-
- no spacewalk plugin installed (rhn-client-tools >= 3.0.1 removes it), or
10-
- the plugin's `enabled = 0` in its config.
5+
1. **Registration / identity** — the system is registered with the CLN
6+
server (`/etc/sysconfig/rhn/systemid`, JWT token), used for licensing
7+
and inventory regardless of how packages are delivered.
118
12-
CLOS-4056: several CloudLinux-specific actors were written when CLN was the
13-
only scheme and assume it is always active. They need to gate their
14-
behavior on `is_cln_configured()` so systems on the no-auth scheme pass
15-
through without bogus inhibitors or crashes.
9+
2. **Package delivery** — the system pulls CloudLinux packages through
10+
the spacewalk DNF/YUM plugin against the CLN-side channel
11+
(`cloudlinux-x86_64-server-N`).
12+
13+
The no-auth (SWNG) transition decouples these. New CL8 and CL9 systems
14+
keep CLN **registration** but no longer use CLN as the **package
15+
channel** — packages come from the SWNG mirrorlist via
16+
`/etc/yum.repos.d/cl.repo` (`cl-channel`) instead. `rhn-client-tools
17+
>= 3.0.1` disables the spacewalk plugin to enforce this.
18+
19+
The CLN-touching actors in this repo only care about the second concern:
20+
they exist to make the CLN package channel work during ELevate. On
21+
systems where the channel has been switched off they should stand down
22+
even though registration may still be present and valid.
23+
24+
CLOS-4056: gate those actors on `is_cln_package_channel_active()`.
1625
"""
1726

1827
import os
@@ -38,16 +47,27 @@ def _plugin_explicitly_disabled(conf_path):
3847
return False
3948

4049

41-
def is_cln_configured():
42-
"""Return True if CLN plumbing is present and not disabled on this system."""
50+
def is_cln_package_channel_active():
51+
"""Return True when CLN is the active package channel for this system.
52+
53+
A True result means the spacewalk DNF/YUM plugin is installed, not
54+
explicitly disabled, and the system has CLN registration state for
55+
the plugin to authenticate with. A False result means the system is
56+
either deregistered or has been moved to the no-auth (SWNG) scheme,
57+
so CLN-targeting actions (channel switch, mirror pinning, version
58+
overrides) are not meaningful and should be skipped.
59+
60+
This is a deliberately heuristic check — it asks "is CLN going to
61+
serve packages here", not "is the system registered with CLN" (the
62+
two were the same thing pre-no-auth and have since diverged).
63+
"""
4364
if not os.path.exists(RHN_SYSTEMID):
4465
return False
4566

4667
configs = [p for p in (SPACEWALK_DNF_CONF, SPACEWALK_YUM_CONF) if os.path.exists(p)]
4768
if not configs:
4869
return False
4970

50-
# If any plugin config explicitly disables the plugin, treat as no-auth.
5171
for conf in configs:
5272
if _plugin_explicitly_disabled(conf):
5373
return False

repos/system_upgrade/cloudlinux/libraries/tests/test_cln_detect.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,49 @@ def _touch(path, content=""):
2121
path.write_text(content)
2222

2323

24-
def test_no_systemid_means_no_cln(clean_paths):
25-
# Without /etc/sysconfig/rhn/systemid the system is not registered with CLN.
26-
assert cln_detect.is_cln_configured() is False
24+
def test_no_systemid_means_channel_inactive(clean_paths):
25+
# Without registration the spacewalk plugin can't authenticate, so even
26+
# if the plugin is installed it is not the active package channel.
27+
assert cln_detect.is_cln_package_channel_active() is False
2728

2829

29-
def test_systemid_but_no_plugin_means_no_cln(clean_paths):
30+
def test_systemid_but_no_plugin_means_channel_inactive(clean_paths):
3031
_touch(clean_paths["systemid"])
31-
assert cln_detect.is_cln_configured() is False
32+
assert cln_detect.is_cln_package_channel_active() is False
3233

3334

34-
def test_systemid_and_enabled_dnf_plugin_means_cln(clean_paths):
35+
def test_systemid_and_enabled_dnf_plugin_means_channel_active(clean_paths):
3536
_touch(clean_paths["systemid"])
3637
_touch(clean_paths["dnf_conf"], "[main]\nenabled = 1\n")
37-
assert cln_detect.is_cln_configured() is True
38+
assert cln_detect.is_cln_package_channel_active() is True
3839

3940

40-
def test_explicit_disabled_dnf_plugin_means_no_cln(clean_paths):
41+
def test_explicit_disabled_dnf_plugin_means_channel_inactive(clean_paths):
4142
_touch(clean_paths["systemid"])
4243
_touch(clean_paths["dnf_conf"], "[main]\nenabled = 0\n")
43-
assert cln_detect.is_cln_configured() is False
44+
assert cln_detect.is_cln_package_channel_active() is False
4445

4546

46-
def test_explicit_disabled_yum_plugin_means_no_cln(clean_paths):
47+
def test_explicit_disabled_yum_plugin_means_channel_inactive(clean_paths):
4748
_touch(clean_paths["systemid"])
4849
_touch(clean_paths["yum_conf"], "[main]\nenabled=0\n")
49-
assert cln_detect.is_cln_configured() is False
50+
assert cln_detect.is_cln_package_channel_active() is False
5051

5152

52-
def test_one_plugin_disabled_one_not_means_no_cln(clean_paths):
53-
# If either plugin config disables it, CLN is not usable.
53+
def test_one_plugin_disabled_one_not_means_channel_inactive(clean_paths):
54+
# If either plugin config disables the plugin, treat the channel as off.
5455
_touch(clean_paths["systemid"])
5556
_touch(clean_paths["dnf_conf"], "[main]\nenabled = 1\n")
5657
_touch(clean_paths["yum_conf"], "[main]\nenabled = 0\n")
57-
assert cln_detect.is_cln_configured() is False
58+
assert cln_detect.is_cln_package_channel_active() is False
5859

5960

60-
def test_plugin_conf_without_enabled_key_means_cln(clean_paths):
61-
# A plugin config that doesn't mention `enabled` defaults to enabled upstream,
62-
# so we must treat it as CLN active.
61+
def test_plugin_conf_without_enabled_key_means_channel_active(clean_paths):
62+
# A plugin config that does not mention `enabled` defaults to enabled
63+
# upstream, so we must treat the channel as active.
6364
_touch(clean_paths["systemid"])
6465
_touch(clean_paths["dnf_conf"], "[main]\ntimeout = 120\n")
65-
assert cln_detect.is_cln_configured() is True
66+
assert cln_detect.is_cln_package_channel_active() is True
6667

6768

6869
def test_comments_and_blank_lines_ignored(clean_paths):
@@ -71,4 +72,4 @@ def test_comments_and_blank_lines_ignored(clean_paths):
7172
clean_paths["dnf_conf"],
7273
"# some comment\n\n[main]\n# enabled = 0\nenabled = 1\n",
7374
)
74-
assert cln_detect.is_cln_configured() is True
75+
assert cln_detect.is_cln_package_channel_active() is True

0 commit comments

Comments
 (0)