Skip to content

Commit

Permalink
Revert "payload: raise exception on non zero exit code from rsync"
Browse files Browse the repository at this point in the history
This reverts commit 44bde41. It
is causing KDE live installs to fail (as it seems rsync has been
exiting non-zero on KDE live installs, but without causing any
apparent problems in the installed system).

resolves: rhbz#2329379
  • Loading branch information
AdamWill committed Nov 28, 2024
1 parent af4caca commit a5dbe6d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,20 @@ def run(self):

try:
self.report_progress(_("Installing software..."))
for line in execReadlines(cmd, args):
reader = execReadlines(cmd, args, raise_on_nozero=False)
for line in reader:
self._parse_rsync_update(line)

except (OSError, RuntimeError) as e:
msg = "Failed to install image: {}".format(e)
raise PayloadInstallationError(msg) from None

if reader.rc == 11:
raise PayloadInstallationError(
"Failed to install image: "
"{} exited with code {}".format(cmd, reader.rc)
)

def _parse_rsync_update(self, line):
"""Try to extract progress from rsync output.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_install_image_task(self, exec_readlines, os_sync):
"--exclude", "/etc/machine-info",
mount_point + "/",
"/mnt/root"
])
], raise_on_nozero=False)

@patch("pyanaconda.modules.payloads.payload.live_image.installation.os.sync")
@patch("pyanaconda.modules.payloads.payload.live_image.installation.execReadlines")
Expand All @@ -140,6 +140,24 @@ def test_install_image_task_failed_exception(self, exec_readlines, os_sync):
msg = "Failed to install image: Fake!"
assert str(cm.value) == msg

@patch("pyanaconda.modules.payloads.payload.live_image.installation.os.sync")
@patch("pyanaconda.modules.payloads.payload.live_image.installation.execReadlines")
def test_install_image_task_failed_return_code(self, exec_readlines, os_sync):
"""Test installation from an image task with bad return code."""
exec_readlines.return_value = self._make_reader(11)

with tempfile.TemporaryDirectory() as mount_point:
task = InstallFromImageTask(
sysroot="/mnt/root",
mount_point=mount_point
)

with pytest.raises(PayloadInstallationError) as cm:
task.run()

msg = "Failed to install image: rsync exited with code 11"
assert str(cm.value) == msg


class InstallFromTarTaskTestCase(unittest.TestCase):
"""Test the InstallFromTarTask class."""
Expand Down

0 comments on commit a5dbe6d

Please sign in to comment.