Skip to content

Automatically rebuild DirectAdmin during elevation #16

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

Merged
merged 4 commits into from
Jun 6, 2024
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
43 changes: 43 additions & 0 deletions repos/system_upgrade/cloudlinux/actors/rebuilddirectadmin/actor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os

from leapp.actors import Actor
from leapp.libraries.stdlib import run, CalledProcessError
from leapp.reporting import Report, create_report
from leapp.tags import FirstBootPhaseTag, IPUWorkflowTag
from leapp.libraries.common.cllaunch import run_on_cloudlinux
from leapp.models import InstalledControlPanel

from leapp.libraries.common.detectcontrolpanel import DIRECTADMIN_NAME


class UpdateDirectAdmin(Actor):
"""
Automatically rebuild directadmin.
"""

name = 'update_directadmin'
consumes = (InstalledControlPanel,)
produces = (Report,)
tags = (FirstBootPhaseTag, IPUWorkflowTag)

@run_on_cloudlinux
def process(self):
panel = next(self.consume(InstalledControlPanel), None)
if panel is None:
raise StopActorExecutionError(message=("Missing information about the installed web panel."))

if panel.name != DIRECTADMIN_NAME:
self.log.debug('DirectAdmin not detected, skip rebuilding')
return

try:
run(['/bin/da', 'build', 'all'], checked=True)
self.log.info('DirectAdmin update was successful')
except CalledProcessError as e:
self.log.error(
'Command "da build all" finished with exit code {}, '
'the system might be unstable.\n'
'Check /usr/local/directadmin/custombuild/custombuild.log, '
'rerun "da build all" after fixing the issues. '
'Contact DirectAdmin support for help.'.format(e.exit_code)
)
Loading