Skip to content

Commit 1ffc487

Browse files
committed
split checking cl license and copying files to container
Intead of checking cl license and at the same time providing TargetUserSpacePreupgradeTasks in on actor, split this logic into two Also stop producing TargetUserSpaceUpgradeTasks as requirements will be already fulfilled with TargetUserSpacePreupgradeTasks execution.
1 parent 21a5ba7 commit 1ffc487

File tree

2 files changed

+45
-26
lines changed
  • repos/system_upgrade/cloudlinux/actors

2 files changed

+45
-26
lines changed

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@
1313

1414
import os
1515

16-
RHN_CONFIG_DIR = '/etc/sysconfig/rhn'
17-
REQUIRED_PKGS = ['dnf-plugin-spacewalk', 'rhn-client-tools']
18-
19-
20-
def rhn_to_target_userspace():
21-
"""
22-
Produce messages to copy RHN configuration files and packages to the target userspace
23-
"""
24-
files_to_copy = []
25-
for dirpath, _, filenames in os.walk(RHN_CONFIG_DIR):
26-
for filename in filenames:
27-
src_path = os.path.join(dirpath, filename)
28-
if os.path.isfile(src_path):
29-
files_to_copy.append(CopyFile(src=src_path))
30-
31-
api.produce(TargetUserSpacePreupgradeTasks(install_rpms=REQUIRED_PKGS, copy_files=files_to_copy))
32-
api.produce(TargetUserSpaceUpgradeTasks(install_rpms=REQUIRED_PKGS, copy_files=files_to_copy))
33-
3416

3517
class CheckClLicense(Actor):
3618
"""
@@ -39,17 +21,12 @@ class CheckClLicense(Actor):
3921

4022
name = 'check_cl_license'
4123
consumes = ()
42-
produces = (Report, TargetUserSpacePreupgradeTasks, TargetUserSpaceUpgradeTasks)
24+
produces = (Report,)
4325
tags = (ChecksPhaseTag, IPUWorkflowTag)
4426

4527
system_id_path = '/etc/sysconfig/rhn/systemid'
4628
rhn_check_bin = '/usr/sbin/rhn_check'
4729

48-
# # Copy RHN data independent from RHSM config
49-
# if os.path.isdir('/etc/sysconfig/rhn'):
50-
# run(['rm', '-rf', os.path.join(target_etc, 'sysconfig/rhn')])
51-
# context.copytree_from('/etc/sysconfig/rhn', os.path.join(target_etc, 'sysconfig/rhn'))
52-
5330
@run_on_cloudlinux
5431
def process(self):
5532
res = None
@@ -69,5 +46,3 @@ def process(self):
6946
reporting.Groups([reporting.Groups.INHIBITOR]),
7047
reporting.Remediation(hint=remediation),
7148
])
72-
else:
73-
rhn_to_target_userspace()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import os
2+
from leapp.actors import Actor
3+
from leapp.reporting import Report
4+
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
5+
from leapp.libraries.common.cllaunch import run_on_cloudlinux
6+
from leapp.libraries.stdlib import api
7+
from leapp.models import (
8+
TargetUserSpacePreupgradeTasks,
9+
CopyFile
10+
)
11+
12+
13+
RHN_CONFIG_DIR = '/etc/sysconfig/rhn'
14+
REQUIRED_PKGS = ['dnf-plugin-spacewalk', 'rhn-client-tools']
15+
16+
17+
class CopyClLicense(Actor):
18+
"""
19+
Produce task to copy CloudLinux license files to target system.
20+
"""
21+
22+
name = 'copy_rhn_client_tools_config'
23+
consumes = ()
24+
produces = (Report, TargetUserSpacePreupgradeTasks)
25+
tags = (ChecksPhaseTag, IPUWorkflowTag)
26+
27+
@run_on_cloudlinux
28+
def process(self):
29+
"""
30+
Produce artifacts to copy RHN configuration files
31+
and install packages to the target userspace,
32+
including up2date and systemid.
33+
"""
34+
files_to_copy = []
35+
for dirpath, _, filenames in os.walk(RHN_CONFIG_DIR):
36+
for filename in filenames:
37+
src_path = os.path.join(dirpath, filename)
38+
if os.path.isfile(src_path):
39+
files_to_copy.append(CopyFile(src=src_path))
40+
41+
api.produce(TargetUserSpacePreupgradeTasks(
42+
install_rpms=REQUIRED_PKGS,
43+
copy_files=files_to_copy
44+
))

0 commit comments

Comments
 (0)