Allow setting runroot_method per Pungi phase.

The `runroot_method` now accepts `dict` value with phase name as a key
and runroot method as a value. For backward compatibility, the `str`
value is still supported.

The new `global_runroot_method` option has been added which defines
the runroot method in case it is not set in `dict` in the `runroot_method`.

This commit allows running `createiso` phase locally while keeping the other
phases in Koji.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-01-02 10:34:03 +01:00 committed by lsedlar
parent b415e31f9d
commit 817acdbbac
7 changed files with 74 additions and 9 deletions

View file

@ -27,6 +27,25 @@ class TestRunrootOpenSSH(helpers.PungiTestCase):
method = self.runroot.get_runroot_method()
self.assertEqual(method, "openssh")
def test_get_runroot_method_phase(self):
self.compose.conf["runroot_method"] = {"ostree": "openssh"}
method = self.runroot.get_runroot_method(phase="ostree")
self.assertEqual(method, "openssh")
# Test fallback to local
method = self.runroot.get_runroot_method(phase="createiso")
self.assertEqual(method, "local")
def test_get_runroot_method_global_runroot_method(self):
self.compose.conf["runroot_method"] = {"ostree": "openssh"}
self.compose.conf["global_runroot_method"] = "koji"
method = self.runroot.get_runroot_method(phase="ostree")
self.assertEqual(method, "openssh")
# Test global_runroot_method
method = self.runroot.get_runroot_method(phase="createiso")
self.assertEqual(method, "koji")
def _ssh_call(self, cmd, suffix=None):
"""
Helper method returning default SSH mock.call with given command `cmd`.