Skip to content

Commit

Permalink
Support Fedora Image Mode
Browse files Browse the repository at this point in the history
- [x] Proof-of-concept
- [ ] Discuss how to solve the scripts location read-only
- [ ] Polish and prepare for merging

Signed-off-by: Miroslav Vadkerti <[email protected]>
  • Loading branch information
thrix committed Sep 19, 2024
1 parent 8245c47 commit 8c1c5db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
32 changes: 18 additions & 14 deletions tmt/steps/execute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from tmt.steps.discover import Discover, DiscoverPlugin, DiscoverStepData
from tmt.steps.provision import Guest
from tmt.utils import (
Command,
Path,
ShellScript,
Stopwatch,
Expand Down Expand Up @@ -77,10 +78,10 @@ class ScriptCreatingFile(Script):

# Script handling reboots, in restraint compatible fashion
TMT_REBOOT_SCRIPT = ScriptCreatingFile(
path=Path("/usr/local/bin/tmt-reboot"),
path=Path("/root/bin/tmt-reboot"),
aliases=[
Path("/usr/local/bin/rstrnt-reboot"),
Path("/usr/local/bin/rhts-reboot")],
Path("/root/bin/rstrnt-reboot"),
Path("/root/bin/rhts-reboot")],
related_variables=[
"TMT_REBOOT_COUNT",
"REBOOTCOUNT",
Expand All @@ -89,36 +90,36 @@ class ScriptCreatingFile(Script):
)

TMT_REBOOT_CORE_SCRIPT = Script(
path=Path("/usr/local/bin/tmt-reboot-core"),
path=Path("/root/bin/tmt-reboot-core"),
aliases=[],
related_variables=[])

# Script handling result reporting, in restraint compatible fashion
TMT_REPORT_RESULT_SCRIPT = ScriptCreatingFile(
path=Path("/usr/local/bin/tmt-report-result"),
path=Path("/root/bin/tmt-report-result"),
aliases=[
Path("/usr/local/bin/rstrnt-report-result"),
Path("/usr/local/bin/rhts-report-result")],
Path("/root/bin/rstrnt-report-result"),
Path("/root/bin/rhts-report-result")],
related_variables=[],
created_file="tmt-report-results.yaml"
)

# Script for archiving a file, usable for BEAKERLIB_COMMAND_SUBMIT_LOG
TMT_FILE_SUBMIT_SCRIPT = Script(
path=Path("/usr/local/bin/tmt-file-submit"),
path=Path("/root/bin/tmt-file-submit"),
aliases=[
Path("/usr/local/bin/rstrnt-report-log"),
Path("/usr/local/bin/rhts-submit-log"),
Path("/usr/local/bin/rhts_submit_log")],
Path("/root/bin/rstrnt-report-log"),
Path("/root/bin/rhts-submit-log"),
Path("/root/bin/rhts_submit_log")],
related_variables=[]
)

# Script handling text execution abortion, in restraint compatible fashion
TMT_ABORT_SCRIPT = ScriptCreatingFile(
path=Path("/usr/local/bin/tmt-abort"),
path=Path("/root/bin/tmt-abort"),
aliases=[
Path("/usr/local/bin/rstrnt-abort"),
Path("/usr/local/bin/rhts-abort")],
Path("/root/bin/rstrnt-abort"),
Path("/root/bin/rhts-abort")],
related_variables=[],
created_file="abort"
)
Expand Down Expand Up @@ -597,6 +598,9 @@ def prepare_tests(self, guest: Guest, logger: tmt.log.Logger) -> list[TestInvoca

def prepare_scripts(self, guest: "tmt.steps.provision.Guest") -> None:
""" Prepare additional scripts for testing """
# Create scripts directory
guest.execute(Command("mkdir", "-p", "/root/bin"))

# Install all scripts on guest
for script in self.scripts:
source = SCRIPTS_SRC_DIR / script.path.name
Expand Down
18 changes: 1 addition & 17 deletions tmt/steps/provision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,23 +1303,7 @@ def _check_rsync(self) -> CheckRsyncOutcome:
except tmt.utils.RunError:
pass

# Install under '/root/pkg' for read-only distros
# (for now the check is based on 'rpm-ostree' presence)
# FIXME: Find a better way how to detect read-only distros
# self.debug("Check for a read-only distro.")
if self.facts.package_manager == 'rpm-ostree':
self.package_manager.install(
Package('rsync'),
options=tmt.package_managers.Options(
install_root=Path('/root/pkg'),
release_version='/'
)
)

self.execute(Command('ln', '-sf', '/root/pkg/bin/rsync', '/usr/local/bin/rsync'))

else:
self.package_manager.install(Package('rsync'))
self.package_manager.install(Package('rsync'))

return CheckRsyncOutcome.INSTALLED

Expand Down

0 comments on commit 8c1c5db

Please sign in to comment.