Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>epel9
parent
11067e5bfe
commit
7fdba43b44
@ -0,0 +1,38 @@
|
|||||||
|
From 5574ad78171c9e9e56f9c565aeb95bd8c6f2d107 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike McLean <mikem@redhat.com>
|
||||||
|
Date: Nov 22 2017 05:24:28 +0000
|
||||||
|
Subject: PR#703: cli: make return code of watch_task to always ignore sub-task failure
|
||||||
|
|
||||||
|
|
||||||
|
Merges #703
|
||||||
|
https://pagure.io/koji/pull-request/703
|
||||||
|
|
||||||
|
Fixes: #696
|
||||||
|
https://pagure.io/koji/issue/696
|
||||||
|
koji 1.14.0 returns exit status 1 on jobs with only optional failures
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py
|
||||||
|
index 4135308..761dff2 100644
|
||||||
|
--- a/cli/koji_cli/lib.py
|
||||||
|
+++ b/cli/koji_cli/lib.py
|
||||||
|
@@ -285,7 +285,7 @@ def watch_tasks(session, tasklist, quiet=False, poll_interval=60):
|
||||||
|
try:
|
||||||
|
tasks = {}
|
||||||
|
for task_id in tasklist:
|
||||||
|
- tasks[task_id] = TaskWatcher(task_id,session,quiet=quiet)
|
||||||
|
+ tasks[task_id] = TaskWatcher(task_id, session, quiet=quiet)
|
||||||
|
while True:
|
||||||
|
all_done = True
|
||||||
|
for task_id, task in list(tasks.items()):
|
||||||
|
@@ -297,7 +297,7 @@ def watch_tasks(session, tasklist, quiet=False, poll_interval=60):
|
||||||
|
# task is done and state just changed
|
||||||
|
if not quiet:
|
||||||
|
display_tasklist_status(tasks)
|
||||||
|
- if not task.is_success():
|
||||||
|
+ if task.level == 0 and not task.is_success():
|
||||||
|
rv = 1
|
||||||
|
for child in session.getTaskChildren(task_id):
|
||||||
|
child_id = child['id']
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
diff -rup koji-1.14.0.orig/koji/__init__.py koji-1.14.0/koji/__init__.py
|
||||||
|
--- koji-1.14.0.orig/koji/__init__.py 2017-09-25 19:37:51.000000000 +0000
|
||||||
|
+++ koji-1.14.0/koji/__init__.py 2017-12-04 17:44:04.774853630 +0000
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
+import copy
|
||||||
|
import sys
|
||||||
|
from six.moves import range
|
||||||
|
from six.moves import zip
|
||||||
|
@@ -2116,16 +2117,15 @@ class ClientSession(object):
|
||||||
|
principal. The principal must be in the "ProxyPrincipals" list on
|
||||||
|
the server side."""
|
||||||
|
|
||||||
|
- if principal is None and keytab is None and ccache is None:
|
||||||
|
- try:
|
||||||
|
- # Silently try GSSAPI first
|
||||||
|
- if self.gssapi_login(proxyuser=proxyuser):
|
||||||
|
- return True
|
||||||
|
- except:
|
||||||
|
- if krbV:
|
||||||
|
- pass
|
||||||
|
- else:
|
||||||
|
- raise
|
||||||
|
+ try:
|
||||||
|
+ # Silently try GSSAPI first
|
||||||
|
+ if self.gssapi_login(principal, keytab, ccache, proxyuser=proxyuser):
|
||||||
|
+ return True
|
||||||
|
+ except:
|
||||||
|
+ if krbV:
|
||||||
|
+ pass
|
||||||
|
+ else:
|
||||||
|
+ raise
|
||||||
|
|
||||||
|
if not krbV:
|
||||||
|
raise PythonImportError(
|
||||||
|
@@ -2203,7 +2203,7 @@ class ClientSession(object):
|
||||||
|
|
||||||
|
return '%s/%s@%s' % (service, servername, realm)
|
||||||
|
|
||||||
|
- def gssapi_login(self, proxyuser=None):
|
||||||
|
+ def gssapi_login(self, principal=None, keytab=None, ccache=None, proxyuser=None):
|
||||||
|
if not HTTPKerberosAuth:
|
||||||
|
raise PythonImportError(
|
||||||
|
"Please install python-requests-kerberos to use GSSAPI."
|
||||||
|
@@ -2220,10 +2220,18 @@ class ClientSession(object):
|
||||||
|
|
||||||
|
# 60 second timeout during login
|
||||||
|
sinfo = None
|
||||||
|
+ old_env = copy.copy(os.environ)
|
||||||
|
old_opts = self.opts
|
||||||
|
self.opts = old_opts.copy()
|
||||||
|
self.opts['timeout'] = 60
|
||||||
|
- self.opts['auth'] = HTTPKerberosAuth()
|
||||||
|
+ kwargs = {}
|
||||||
|
+ if keytab:
|
||||||
|
+ os.environ['KRB5_CLIENT_KTNAME'] = keytab
|
||||||
|
+ if ccache:
|
||||||
|
+ os.environ['KRB5CCNAME'] = ccache
|
||||||
|
+ if principal:
|
||||||
|
+ kwargs['principal'] = principal
|
||||||
|
+ self.opts['auth'] = HTTPKerberosAuth(**kwargs)
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
# Depending on the server configuration, we might not be able to
|
||||||
|
@@ -2235,6 +2243,7 @@ class ClientSession(object):
|
||||||
|
self.baseurl = old_baseurl
|
||||||
|
finally:
|
||||||
|
self.opts = old_opts
|
||||||
|
+ os.environ = old_env
|
||||||
|
if not sinfo:
|
||||||
|
raise AuthError('unable to obtain a session')
|
||||||
|
|
||||||
|
Only in koji-1.14.0/koji: __init__.py.orig
|
@ -0,0 +1,27 @@
|
|||||||
|
From 73ebc0c98fb7766f2ddddc41f0a2ab662ba5c467 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yuming Zhu <yzhu@redhat.com>
|
||||||
|
Date: Nov 22 2017 05:24:24 +0000
|
||||||
|
Subject: cli: make return code of watch_task to always ignore sub-task failure
|
||||||
|
|
||||||
|
|
||||||
|
fixes: #696
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py
|
||||||
|
index 4135308..e7aa686 100644
|
||||||
|
--- a/cli/koji_cli/lib.py
|
||||||
|
+++ b/cli/koji_cli/lib.py
|
||||||
|
@@ -218,9 +218,11 @@ class TaskWatcher(object):
|
||||||
|
state = koji.TASK_STATES[self.info['state']]
|
||||||
|
return (state in ['CLOSED','CANCELED','FAILED'])
|
||||||
|
|
||||||
|
- def is_success(self):
|
||||||
|
+ def is_success(self, ignore_child=True):
|
||||||
|
if self.info is None:
|
||||||
|
return False
|
||||||
|
+ if ignore_child and self.level != 0:
|
||||||
|
+ return True
|
||||||
|
state = koji.TASK_STATES[self.info['state']]
|
||||||
|
return (state == 'CLOSED')
|
||||||
|
|
Loading…
Reference in new issue