diff --git a/pungi/runroot.py b/pungi/runroot.py index b9b1618e..f4e7d9c3 100644 --- a/pungi/runroot.py +++ b/pungi/runroot.py @@ -84,7 +84,7 @@ class Runroot(kobo.log.LoggingBase): koji_wrapper = kojiwrapper.KojiWrapper(self.compose.conf["koji_profile"]) koji_cmd = koji_wrapper.get_runroot_cmd( runroot_tag, arch, command, - channel=runroot_channel, use_shell=True, task_id=True, + channel=runroot_channel, use_shell=True, packages=packages, **kwargs ) diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index c4ec83fa..ca61160c 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -72,8 +72,8 @@ class KojiWrapper(object): def get_runroot_cmd(self, target, arch, command, quiet=False, use_shell=True, channel=None, packages=None, mounts=None, weight=None, - task_id=True, new_chroot=False, chown_paths=None): - cmd = self._get_cmd("runroot", "--nowait") + new_chroot=False, chown_paths=None): + cmd = self._get_cmd("runroot", "--nowait", "--task-id") if quiet: cmd.append("--quiet") @@ -84,9 +84,6 @@ class KojiWrapper(object): if use_shell: cmd.append("--use-shell") - if task_id: - cmd.append("--task-id") - if channel: cmd.append("--channel-override=%s" % channel) else: @@ -142,11 +139,11 @@ class KojiWrapper(object): yield None def run_runroot_cmd(self, command, log_file=None): - """ - Run koji runroot command and wait for results. + """Run koji runroot command and wait for results. - If the command specified --task-id, and the first line of output - contains the id, it will be captured and returned. + :param list command: runroot command returned by self.get_runroot_cmd() + :param str log_file: save logs to log_file + :return dict: {"retcode": 0, "output": "", "task_id": 1} """ task_id = None with self.get_koji_cmd_env() as env: diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 15464a1f..57d77c3c 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -623,7 +623,7 @@ class BuildinstallThreadTestCase(PungiTestCase): get_runroot_cmd.mock_calls, [mock.call( 'rrt', 'x86_64', self.cmd, channel=None, - use_shell=True, task_id=True, + use_shell=True, packages=['lorax'], mounts=[self.topdir], weight=123, chown_paths=[ destdir, @@ -694,7 +694,7 @@ class BuildinstallThreadTestCase(PungiTestCase): get_runroot_cmd.mock_calls, [mock.call( "rrt", "amd64", self.cmd, channel=None, - use_shell=True, task_id=True, + use_shell=True, packages=['anaconda'], mounts=[self.topdir], weight=None, chown_paths=[destdir], )]) @@ -864,7 +864,7 @@ class BuildinstallThreadTestCase(PungiTestCase): get_runroot_cmd.mock_calls, [mock.call( 'rrt', 'x86_64', self.cmd, channel=None, - use_shell=True, task_id=True, + use_shell=True, packages=['lorax'], mounts=[self.topdir], weight=123, chown_paths=[ "/buildinstall_topdir/buildinstall-%s/x86_64/Server" % os.path.basename(self.topdir), diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py index 91329ca7..f6bd6a51 100644 --- a/tests/test_createiso_phase.py +++ b/tests/test_createiso_phase.py @@ -380,7 +380,7 @@ class CreateisoThreadTest(helpers.PungiTestCase): mounts=[self.topdir], packages=['coreutils', 'genisoimage', 'isomd5sum', 'jigdo'], - task_id=True, use_shell=True, weight=None)]) + use_shell=True, weight=None)]) self.assertEqual( run_runroot.call_args_list, [mock.call(get_runroot_cmd.return_value, @@ -443,7 +443,7 @@ class CreateisoThreadTest(helpers.PungiTestCase): [mock.call('f25-build', 'x86_64', cmd['cmd'], channel=None, mounts=[self.topdir], packages=['coreutils', 'genisoimage', 'isomd5sum'], - task_id=True, use_shell=True, weight=123)]) + use_shell=True, weight=123)]) self.assertEqual( run_runroot.call_args_list, [mock.call(get_runroot_cmd.return_value, @@ -508,7 +508,7 @@ class CreateisoThreadTest(helpers.PungiTestCase): mounts=[self.topdir], packages=['coreutils', 'genisoimage', 'isomd5sum', 'jigdo', 'lorax', 'which'], - task_id=True, use_shell=True, weight=None)]) + use_shell=True, weight=None)]) self.assertEqual( run_runroot.call_args_list, [mock.call(get_runroot_cmd.return_value, diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index a21bb9aa..2ba6b02d 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -424,13 +424,13 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase): class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): def test_get_cmd_minimal(self): - cmd = self.koji.get_runroot_cmd('tgt', 's390x', 'date', use_shell=False, task_id=False) - self.assertEqual(len(cmd), 8) - self.assertEqual(cmd[:3], ['koji', '--profile=custom-koji', 'runroot']) + cmd = self.koji.get_runroot_cmd('tgt', 's390x', 'date', use_shell=False) + self.assertEqual(len(cmd), 9) + self.assertEqual(cmd[:5], ['koji', '--profile=custom-koji', 'runroot', '--nowait', '--task-id']) self.assertEqual(cmd[-3], 'tgt') self.assertEqual(cmd[-2], 's390x') self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date') - six.assertCountEqual(self, cmd[4:-3], ["--channel-override=runroot-local"]) + six.assertCountEqual(self, cmd[5:-3], ["--channel-override=runroot-local"]) def test_get_cmd_full(self): cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'], diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index cb0fbcae..6542a24a 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -156,7 +156,7 @@ class OstreeThreadTest(helpers.PungiTestCase): 'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)), channel=None, mounts=[self.topdir], packages=['pungi', 'lorax', 'ostree'] + extra_pkgs, - task_id=True, use_shell=True, weight=weight, + use_shell=True, weight=weight, chown_paths=[outdir])]) self.assertEqual(koji.run_runroot_cmd.call_args_list, [mock.call(koji.get_runroot_cmd.return_value, diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py index 05b59133..692ab88e 100644 --- a/tests/test_ostree_phase.py +++ b/tests/test_ostree_phase.py @@ -214,7 +214,7 @@ class OSTreeThreadTest(helpers.PungiTestCase): '--extra-config=%s/extra_config.json' % (self.topdir + '/work/ostree-1')], channel=None, mounts=[self.topdir, self.repo], packages=['pungi', 'ostree', 'rpm-ostree'], - task_id=True, use_shell=True, new_chroot=True, weight=123)]) + use_shell=True, new_chroot=True, weight=123)]) self.assertEqual(koji.run_runroot_cmd.call_args_list, [mock.call(koji.get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')]) @@ -384,7 +384,7 @@ class OSTreeThreadTest(helpers.PungiTestCase): '--update-summary'], channel=None, mounts=[self.topdir, self.repo], packages=['pungi', 'ostree', 'rpm-ostree'], - task_id=True, use_shell=True, new_chroot=True, weight=None)]) + use_shell=True, new_chroot=True, weight=None)]) self.assertEqual(koji.run_runroot_cmd.call_args_list, [mock.call(koji.get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')]) @@ -419,7 +419,7 @@ class OSTreeThreadTest(helpers.PungiTestCase): '--extra-config=%s/work/ostree-1/extra_config.json' % self.topdir], channel=None, mounts=[self.topdir, self.repo], packages=['pungi', 'ostree', 'rpm-ostree'], - task_id=True, use_shell=True, new_chroot=True, weight=None)]) + use_shell=True, new_chroot=True, weight=None)]) self.assertEqual(koji.run_runroot_cmd.call_args_list, [mock.call(koji.get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')]) @@ -454,7 +454,7 @@ class OSTreeThreadTest(helpers.PungiTestCase): '--extra-config=%s/work/ostree-1/extra_config.json' % self.topdir], channel=None, mounts=[self.topdir, self.repo], packages=['pungi', 'ostree', 'rpm-ostree'], - task_id=True, use_shell=True, new_chroot=True, weight=None)]) + use_shell=True, new_chroot=True, weight=None)]) self.assertEqual(koji.run_runroot_cmd.call_args_list, [mock.call(koji.get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])