Make --task-id mandatory in get_runroot_cmd
JIRA: COMPOSE-4027 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
bce57c2e66
commit
6eb6511aa6
@ -84,7 +84,7 @@ class Runroot(kobo.log.LoggingBase):
|
|||||||
koji_wrapper = kojiwrapper.KojiWrapper(self.compose.conf["koji_profile"])
|
koji_wrapper = kojiwrapper.KojiWrapper(self.compose.conf["koji_profile"])
|
||||||
koji_cmd = koji_wrapper.get_runroot_cmd(
|
koji_cmd = koji_wrapper.get_runroot_cmd(
|
||||||
runroot_tag, arch, command,
|
runroot_tag, arch, command,
|
||||||
channel=runroot_channel, use_shell=True, task_id=True,
|
channel=runroot_channel, use_shell=True,
|
||||||
packages=packages, **kwargs
|
packages=packages, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ class KojiWrapper(object):
|
|||||||
|
|
||||||
def get_runroot_cmd(self, target, arch, command, quiet=False, use_shell=True,
|
def get_runroot_cmd(self, target, arch, command, quiet=False, use_shell=True,
|
||||||
channel=None, packages=None, mounts=None, weight=None,
|
channel=None, packages=None, mounts=None, weight=None,
|
||||||
task_id=True, new_chroot=False, chown_paths=None):
|
new_chroot=False, chown_paths=None):
|
||||||
cmd = self._get_cmd("runroot", "--nowait")
|
cmd = self._get_cmd("runroot", "--nowait", "--task-id")
|
||||||
|
|
||||||
if quiet:
|
if quiet:
|
||||||
cmd.append("--quiet")
|
cmd.append("--quiet")
|
||||||
@ -84,9 +84,6 @@ class KojiWrapper(object):
|
|||||||
if use_shell:
|
if use_shell:
|
||||||
cmd.append("--use-shell")
|
cmd.append("--use-shell")
|
||||||
|
|
||||||
if task_id:
|
|
||||||
cmd.append("--task-id")
|
|
||||||
|
|
||||||
if channel:
|
if channel:
|
||||||
cmd.append("--channel-override=%s" % channel)
|
cmd.append("--channel-override=%s" % channel)
|
||||||
else:
|
else:
|
||||||
@ -142,11 +139,11 @@ class KojiWrapper(object):
|
|||||||
yield None
|
yield None
|
||||||
|
|
||||||
def run_runroot_cmd(self, command, log_file=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
|
:param list command: runroot command returned by self.get_runroot_cmd()
|
||||||
contains the id, it will be captured and returned.
|
:param str log_file: save logs to log_file
|
||||||
|
:return dict: {"retcode": 0, "output": "", "task_id": 1}
|
||||||
"""
|
"""
|
||||||
task_id = None
|
task_id = None
|
||||||
with self.get_koji_cmd_env() as env:
|
with self.get_koji_cmd_env() as env:
|
||||||
|
@ -623,7 +623,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
'rrt', 'x86_64', self.cmd, channel=None,
|
'rrt', 'x86_64', self.cmd, channel=None,
|
||||||
use_shell=True, task_id=True,
|
use_shell=True,
|
||||||
packages=['lorax'], mounts=[self.topdir], weight=123,
|
packages=['lorax'], mounts=[self.topdir], weight=123,
|
||||||
chown_paths=[
|
chown_paths=[
|
||||||
destdir,
|
destdir,
|
||||||
@ -694,7 +694,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
"rrt", "amd64", self.cmd, channel=None,
|
"rrt", "amd64", self.cmd, channel=None,
|
||||||
use_shell=True, task_id=True,
|
use_shell=True,
|
||||||
packages=['anaconda'], mounts=[self.topdir], weight=None,
|
packages=['anaconda'], mounts=[self.topdir], weight=None,
|
||||||
chown_paths=[destdir],
|
chown_paths=[destdir],
|
||||||
)])
|
)])
|
||||||
@ -864,7 +864,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
'rrt', 'x86_64', self.cmd, channel=None,
|
'rrt', 'x86_64', self.cmd, channel=None,
|
||||||
use_shell=True, task_id=True,
|
use_shell=True,
|
||||||
packages=['lorax'], mounts=[self.topdir], weight=123,
|
packages=['lorax'], mounts=[self.topdir], weight=123,
|
||||||
chown_paths=[
|
chown_paths=[
|
||||||
"/buildinstall_topdir/buildinstall-%s/x86_64/Server" % os.path.basename(self.topdir),
|
"/buildinstall_topdir/buildinstall-%s/x86_64/Server" % os.path.basename(self.topdir),
|
||||||
|
@ -380,7 +380,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||||||
mounts=[self.topdir],
|
mounts=[self.topdir],
|
||||||
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
||||||
'jigdo'],
|
'jigdo'],
|
||||||
task_id=True, use_shell=True, weight=None)])
|
use_shell=True, weight=None)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
run_runroot.call_args_list,
|
run_runroot.call_args_list,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[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,
|
[mock.call('f25-build', 'x86_64', cmd['cmd'], channel=None,
|
||||||
mounts=[self.topdir],
|
mounts=[self.topdir],
|
||||||
packages=['coreutils', 'genisoimage', 'isomd5sum'],
|
packages=['coreutils', 'genisoimage', 'isomd5sum'],
|
||||||
task_id=True, use_shell=True, weight=123)])
|
use_shell=True, weight=123)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
run_runroot.call_args_list,
|
run_runroot.call_args_list,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[mock.call(get_runroot_cmd.return_value,
|
||||||
@ -508,7 +508,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||||||
mounts=[self.topdir],
|
mounts=[self.topdir],
|
||||||
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
||||||
'jigdo', 'lorax', 'which'],
|
'jigdo', 'lorax', 'which'],
|
||||||
task_id=True, use_shell=True, weight=None)])
|
use_shell=True, weight=None)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
run_runroot.call_args_list,
|
run_runroot.call_args_list,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[mock.call(get_runroot_cmd.return_value,
|
||||||
|
@ -424,13 +424,13 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
|
|
||||||
class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
||||||
def test_get_cmd_minimal(self):
|
def test_get_cmd_minimal(self):
|
||||||
cmd = self.koji.get_runroot_cmd('tgt', 's390x', 'date', use_shell=False, task_id=False)
|
cmd = self.koji.get_runroot_cmd('tgt', 's390x', 'date', use_shell=False)
|
||||||
self.assertEqual(len(cmd), 8)
|
self.assertEqual(len(cmd), 9)
|
||||||
self.assertEqual(cmd[:3], ['koji', '--profile=custom-koji', 'runroot'])
|
self.assertEqual(cmd[:5], ['koji', '--profile=custom-koji', 'runroot', '--nowait', '--task-id'])
|
||||||
self.assertEqual(cmd[-3], 'tgt')
|
self.assertEqual(cmd[-3], 'tgt')
|
||||||
self.assertEqual(cmd[-2], 's390x')
|
self.assertEqual(cmd[-2], 's390x')
|
||||||
self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date')
|
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):
|
def test_get_cmd_full(self):
|
||||||
cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'],
|
cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'],
|
||||||
|
@ -156,7 +156,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)),
|
'rm -rf %s && %s' % (outdir, ' '.join(lorax_cmd)),
|
||||||
channel=None, mounts=[self.topdir],
|
channel=None, mounts=[self.topdir],
|
||||||
packages=['pungi', 'lorax', 'ostree'] + extra_pkgs,
|
packages=['pungi', 'lorax', 'ostree'] + extra_pkgs,
|
||||||
task_id=True, use_shell=True, weight=weight,
|
use_shell=True, weight=weight,
|
||||||
chown_paths=[outdir])])
|
chown_paths=[outdir])])
|
||||||
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||||
[mock.call(koji.get_runroot_cmd.return_value,
|
[mock.call(koji.get_runroot_cmd.return_value,
|
||||||
|
@ -214,7 +214,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||||||
'--extra-config=%s/extra_config.json' % (self.topdir + '/work/ostree-1')],
|
'--extra-config=%s/extra_config.json' % (self.topdir + '/work/ostree-1')],
|
||||||
channel=None, mounts=[self.topdir, self.repo],
|
channel=None, mounts=[self.topdir, self.repo],
|
||||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
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,
|
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||||
[mock.call(koji.get_runroot_cmd.return_value,
|
[mock.call(koji.get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
||||||
@ -384,7 +384,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||||||
'--update-summary'],
|
'--update-summary'],
|
||||||
channel=None, mounts=[self.topdir, self.repo],
|
channel=None, mounts=[self.topdir, self.repo],
|
||||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
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,
|
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||||
[mock.call(koji.get_runroot_cmd.return_value,
|
[mock.call(koji.get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
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],
|
'--extra-config=%s/work/ostree-1/extra_config.json' % self.topdir],
|
||||||
channel=None, mounts=[self.topdir, self.repo],
|
channel=None, mounts=[self.topdir, self.repo],
|
||||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
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,
|
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||||
[mock.call(koji.get_runroot_cmd.return_value,
|
[mock.call(koji.get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
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],
|
'--extra-config=%s/work/ostree-1/extra_config.json' % self.topdir],
|
||||||
channel=None, mounts=[self.topdir, self.repo],
|
channel=None, mounts=[self.topdir, self.repo],
|
||||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
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,
|
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||||
[mock.call(koji.get_runroot_cmd.return_value,
|
[mock.call(koji.get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
||||||
|
Loading…
Reference in New Issue
Block a user