Commit graph

582 commits

Author SHA1 Message Date
Mike McLean
75982719c1 Use VirtualCall helper 2019-06-17 10:19:12 -04:00
Mike McLean
bb110da972 first stab at a new multicall approach 2019-06-17 10:19:12 -04:00
Tomas Kopecek
558e129c6b use same arch parsing for cli and hub
Related: https://pagure.io/koji/issue/1237
2019-05-21 18:39:52 -04:00
Tomas Kopecek
e9be2d2464 fix docstring 2019-05-21 12:18:19 -04:00
Tomas Kopecek
df11172629 fix str-type testing in fix_encoding
Fixes: https://pagure.io/koji/issue/1318
2019-05-21 12:18:19 -04:00
Mike McLean
7532682f5e drop duplicate logic 2019-05-21 12:18:19 -04:00
Mike McLean
d2350991eb refactor fixEncodingRecurse 2019-05-21 12:18:19 -04:00
Mike McLean
6c0aacc264 pathinfo.distrepo volume option 2019-05-21 12:14:33 -04:00
Mike McLean
a9fc077a1a fix mode name 2019-05-06 11:23:19 -04:00
Mike McLean
be6ae53fb6 handle bare merge mode
Fixes https://pagure.io/koji/issue/1404
2019-05-06 11:23:19 -04:00
Tomas Kopecek
12cabb0f2c Remove 'keepalive' option
keepalive is not used anymore anywhere in koji

Fixes: https://pagure.io/koji/issue/1239
2019-03-12 10:34:36 -04:00
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
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
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
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
Tomas Kopecek
ca86a8fa78 fix xmlrpc encoding error 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
ca29c78046 fix bytes/str in rpm header 2019-02-05 15:49:54 +01: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
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
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
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
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
Tomas Kopecek
1886fe54a6 check rpm headers support directly 2018-08-16 13:36:07 -04:00
Tomas Kopecek
27abb872c6 Expand user directory from config
Fixes: https://pagure.io/koji/issue/1022
2018-08-16 09:09:29 -04:00
Tomas Kopecek
3cc443df97 Fix isinstance with lists
Fixes: https://pagure.io/koji/issue/1011
2018-08-08 11:34:39 -04:00
Franz Chih-Ping Hsieh
646c43561a decode_args(): make a copy of the opts dict, rather than modifying it in-place
Fixes: #1007
https://pagure.io/koji/issue/1007

  Author: Mike Bonnet <mikeb@redhat.com>
  Date:   Wed Jul 18 17:03:56 2018 -0700

    The commit changes make_task() to call decode_args() on the arglist before
    it is saved to the db. If the method was called with keyword arguments, those
    would be passed in a dict at the end of the arglist, with a __starstar entry.
    decode_args() edits that dict in place, removing the __starstar entry and
    making the arglist appear to end in a single dict argument, effectively
    removing the keyword arguments. This change makes a copy of the dict before
2018-07-25 15:07:11 -04:00
Tomas Kopecek
caae1a0a8b workaround unnecessary list conversions 2018-07-11 17:37:40 -04:00
Tomas Kopecek
b37236d7ae fix incorrect divisions 2018-07-11 17:37:40 -04:00
Tomas Kopecek
8e61dc7c56 python-modernize -f libmodernize.fixes.fix_classic_division 2018-07-11 17:37:40 -04:00
Mike McLean
ae025524ab clean up docstring for multiCall() 2018-06-27 11:34:50 -04:00
Yuming Zhu
60a23818a1 add warning for batch usage in clone-tag 2018-06-27 11:34:50 -04:00
Yuming Zhu
3bddf540b4 set default batch to None and use generator instead of list 2018-06-27 11:34:50 -04:00
Yuming Zhu
073a8bd043 cli: add batch option in multiCall 2018-06-27 11:33:34 -04:00
David Abdurachmanov
5b2014f8c0 Fix use_host_resolv with new mock version (2017 Nov 22+)
The change done in mock on 2017 Nov 22:

    782e150ffda41c55351c56eff6601a2cc1b8e4fe / [RHBZ#1514028]

now requires rpmbuild_networking to be used together with use_host_resolv
otherwise it does not have an affect. While setting up Fedora RISC-V koji
instance we noticed that /etc/resolv.conf was never copied into chroot,
while /ets/hosts was always present.

The following was tested on Fedora RISC-V instance and resolved the original
problem (buildSRPMFromSCM was failing on fedpkg sources as it couldn't
resolve src.fedoraproject.org)

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-06-13 12:30:19 -04:00
Mike McLean
024782eacc also forget requests session in _forget() 2018-04-30 16:56:11 -04:00
Tomas Kopecek
1b07d95ccf print debug and error messages to stderr
Fixes: https://pagure.io/koji/issue/671
2018-04-24 17:01:51 -04:00
Mike McLean
c246f719b8 Show the krb principal name in debug log
This may help users realize when they are trying to authenticate
with the wrong ticket.
2018-04-02 16:40:04 -04:00