Skip to content

Commit c2aa65b

Browse files
committed
Change detection of DirectAdmin to detectcontrolpanel lib
1 parent 963e6d6 commit c2aa65b

File tree

1 file changed

+22
-13
lines changed
  • repos/system_upgrade/cloudlinux/actors/rebuilddirectadmin

1 file changed

+22
-13
lines changed

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from leapp.reporting import Report, create_report
66
from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
77
from leapp.libraries.common.cllaunch import run_on_cloudlinux
8+
from leapp.models import InstalledControlPanel
9+
10+
from leapp.libraries.common.detectcontrolpanel import DIRECTADMIN_NAME
811

912

1013
class UpdateDirectAdmin(Actor):
@@ -13,21 +16,27 @@ class UpdateDirectAdmin(Actor):
1316
"""
1417

1518
name = 'update_directadmin'
16-
consumes = ()
19+
consumes = (InstalledControlPanel,)
1720
produces = (Report,)
1821
tags = (FirstBootPhaseTag, IPUWorkflowTag)
1922

2023
@run_on_cloudlinux
2124
def process(self):
22-
if os.path.exists('/bin/da'):
23-
try:
24-
run(['/bin/da', 'build', 'all'], checked=True)
25-
self.log.info('DirectAdmin update was successful')
26-
except CalledProcessError as e:
27-
self.log.error(
28-
'Command "da build all" finished with exit code {}, '
29-
'the system might be unstable.\n'
30-
'Check /usr/local/directadmin/custombuild/custombuild.log, '
31-
'rerun "da build all" after fixing the issues. '
32-
'Contact DirectAdmin support for help.'.format(e.exit_code)
33-
)
25+
panel = next(self.consume(InstalledControlPanel), None)
26+
if panel is None:
27+
raise StopActorExecutionError(message=("Missing information about the installed web panel."))
28+
29+
if panel.name != DIRECTADMIN_NAME:
30+
self.log.debug('DirectAdmin not detected, skip rebuilding')
31+
32+
try:
33+
run(['/bin/da', 'build', 'all'], checked=True)
34+
self.log.info('DirectAdmin update was successful')
35+
except CalledProcessError as e:
36+
self.log.error(
37+
'Command "da build all" finished with exit code {}, '
38+
'the system might be unstable.\n'
39+
'Check /usr/local/directadmin/custombuild/custombuild.log, '
40+
'rerun "da build all" after fixing the issues. '
41+
'Contact DirectAdmin support for help.'.format(e.exit_code)
42+
)

0 commit comments

Comments
 (0)