Commit graph

632 commits

Author SHA1 Message Date
Mike McLean
3a10134e37 honor remove_nonprintable in fixEncodingRecurse under py3 2019-03-04 10:13:51 -05:00
Tomas Kopecek
eeeeb3ab78 skip fixEncoding for py3 2019-03-04 10:13:51 -05:00
Tomas Kopecek
613d1587a6 fix typo 2019-03-04 10:13:51 -05:00
Tomas Kopecek
4372ecd89b expect string keys in fixEncodingRecurse 2019-03-04 10:13:51 -05:00
Mike McLean
01b0a41639 fix file open mode 2019-03-04 09:28:39 -05:00
Mike McLean
acf5c73ee2 use base64.b64decode 2019-03-04 09:28:39 -05:00
Mike McLean
24f9cb60ba use base64encode most places 2019-03-04 09:28:39 -05:00
Mike McLean
71bc4106b4 new base64 helper functions 2019-03-04 09:28:39 -05:00
Tomas Kopecek
86f3c5b095 decode Popen.communicate result under py3
Fixes: https://pagure.io/koji/issue/1270
2019-02-20 15:30:01 -05:00
Mike McLean
0b5a0d691f only adjust the request encoding on py3 2019-02-19 12:47:00 -05:00
Tomas Kopecek
3e595b0244 Fix non-ascii strings in xmlrpc
requests library refuse to upload non-latin-1 strings, convert data to
utf-8 before passing to library.

Fixes: https://pagure.io/koji/issue/1219
2019-02-19 12:47:00 -05:00
Yu Ming Zhu
dc208d0555 fix invokings and unittests 2019-02-17 21:26:13 -05:00
Mike McLean
b0c8f817fe drop parser option in favor of raw option 2019-02-17 21:26:13 -05:00
Yuming Zhu
eaa1b8694b docstring for read_config_files 2019-02-17 21:26:13 -05:00
Yu Ming Zhu
9ddae41877 using ConfigParser.read_file for PY3 2019-02-17 21:26:13 -05:00
Mike McLean
c2322e4f26 note origin of koji.arch and chmod -x the lib 2019-02-12 16:24:13 -05:00
Tomas Kopecek
ca86a8fa78 fix xmlrpc encoding error 2019-02-12 16:09:19 -05:00
Tomas Kopecek
ccf1c41274 fixes 2019-02-12 16:09:19 -05:00
Tomas Kopecek
009081c0fc bundle rpmUtils.arch 2019-02-12 16:09:19 -05:00
Tomas Kopecek
ed01f8d299 reorder imports 2019-02-12 16:09:19 -05:00
Tomas Kopecek
426a8c2b16 rpm builds 2019-02-12 16:06:00 -05:00
Tomas Kopecek
d3766c19b5 replace obsoleted libs 2019-02-12 16:06:00 -05:00
Tomas Kopecek
afa636264a fix import 2019-02-05 15:49:54 +01:00
Tomas Kopecek
ca29c78046 fix bytes/str in rpm header 2019-02-05 15:49:54 +01:00
Yu Ming Zhu
dc66521ceb misc changes for build and test 2019-01-28 08:46:11 -05:00
Yu Ming Zhu
30c2e5f426 sorted set in Error msgs of tasks.find_arch 2019-01-28 08:46:11 -05:00
Yu Ming Zhu
200951c9d6 fix zip for python3 2019-01-28 08:46:11 -05:00
Yu Ming Zhu
7ab1e2901d urllib fix for python3 2019-01-28 08:45:18 -05:00
Tomas Kopecek
ccdb8ac34c Use python2/3 instead of python in Makefile/spec
Fixes: https://pagure.io/koji/issue/1018
2019-01-28 06:06:50 -05:00
Adam Williamson
1b6382891c Fix is_conn_error() for Python 3.3+ change to socket.error
In Python 3.3+, `socket.error` is no longer a distinct exception.
It is - as the docs say - "A deprecated alias of OSError". This
means that this check:

`isinstance(e, socket.error)`

is effectively equivalent to:

`isinstance(e, OSError)`

This is a problem, because `requests.exceptions.ConnectionError`
(another exception type we handle later in `is_conn_error()`) is
a subclass of `OSError` - so on Python 3 we never actually reach
the block that's intended to handle that exception type. We hit
the `isinstance(e, socket.error)` block at the start instead, and
of course the exception doesn't have an `errno` attribute, so we
just return `False` at that point.

There are a few different ways we could fix this; this commit
does it by ditching the `isinstance` checks, and dropping the
shortcut `return False` bailout from the early block. We'll still
ultimately return `False` unless the error is actually one of the
other types we handle; it just costs a couple more `isinstance`
checks.

I don't think replacing the `isinstance socket.error` checks is
really necessary at all. We can just check for an `errno` attr,
and if there is one and it's one of the values we check for...
that seems safe enough to treat as a connection error.

This also changes the second check to be a check of `e2`, not
`e` - I'm *fairly* sure this is what's actually intended, and
the current code was a copy-paste error.

Fixes: #1192

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2019-01-15 11:33:14 -05:00
Mike McLean
4fa2901720 cleanup
unused var
whitespace
missing import
2019-01-15 10:51:19 -05:00
Tomas Kopecek
4191840bd7 check_sigmd5 for kojivmd 2019-01-15 10:51:19 -05:00
mprahl
5687f7bcef Don't force the Kerberos cache to be stored as a file when using the ccache kwarg on krb_login
A multi-threaded application may choose to store the Kerberos cache in the
thread keyring [1] to avoid Kerberos cache corruption. Since `krb_login` prepends
the passed in `ccache` with `FILE:`, the application must resort to setting the
`KRB_CCACHE` environment variable. This is annoying and unnecessary because
ccache defaults to `FILE` anyways if no Kerberos cache type is specified in the
value for `ccache` [2].

1 - http://man7.org/linux/man-pages/man7/thread-keyring.7.html
2 - https://web.mit.edu/kerberos/krb5-1.12/doc/basic/ccache_def.html#ccache-types
2018-12-13 12:57:45 -05:00
mprahl
4b6c92045f Add a ctx kwarg to ClientSession.krb_login
Before this change, `koji.ClientSession.krb_login` always used the
default context. This can be an issue when a multi-threaded application
shares this context and the Kerberos cache is stored in the thread keyring.
In this scenario, the first thread to run `krb_login` will succeed while
all others will get a "Permission denied" error. By adding the `ctx` kwarg,
a thread can establish a context and tell `krb_login` to use it instead of
the default context.
2018-12-13 12:49:38 -05:00
Tomas Kopecek
17db100db5 few sort speedups
Fixes: https://pagure.io/koji/issue/963
2018-12-04 00:05:26 -05:00
Tomas Kopecek
f4ee150026 drop encode_int helper
We're already using i8 encoding mechanism, so this function is no more
needed.

Fixes: https://pagure.io/koji/issue/750
2018-12-03 23:55:39 -05:00
Mike McLean
cc7afa1b17 more tests and another fix 2018-12-03 15:54:07 -05:00
Mike McLean
beac7899ec partial unit test with minor fix 2018-12-03 15:54:07 -05:00
Mike McLean
25d8e41f31 cleanup 2018-12-03 15:54:07 -05:00
Mike McLean
2ab6a6eff0 initialize TaskManager.skipped_tasks 2018-12-03 15:54:07 -05:00
Mike McLean
c3b7c815cb add a timeout for skipping a task based on bin capacity 2018-12-03 15:54:07 -05:00
Tomas Kopecek
9963877545 move move_and_symlink to koji.util 2018-11-28 16:27:30 -05:00
Tomas Kopecek
8370a8e0ad don't fail on missing field in base policy tests
Fixes: https://pagure.io/koji/issue/1038
2018-11-28 09:01:20 +01:00
Yuming Zhu
5214e54ff0 set default value for timeout and auth_timeout in read_config
and do not override auth_timeout = 0 by default: 60 which means no timeout
2018-11-27 10:39:11 -05:00
Yuming Zhu
2696f35b55 make timeout of authentication configurable 2018-11-27 10:39:11 -05:00
Yuming Zhu
cab5a01dcb move tests to test_lib/test_context.py 2018-11-22 18:43:31 +08:00
Yuming Zhu
2394682a4d remove shebang in context module 2018-11-22 02:48:36 +08:00
Tomas Kopecek
8e7414acff fix comment indentation for flake8 2018-10-18 14:46:35 +02:00
Tomas Kopecek
0fecbc969b Don't retry if certificate is not readable
Fixes: https://pagure.io/koji/issue/1108
2018-10-18 14:46:35 +02:00
Mike McLean
95591103ca support merge_mode field 2018-09-20 12:37:26 -04:00