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>
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
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.
Fixes: #1007https://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
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>