Commit graph

447 commits

Author SHA1 Message Date
Mike McLean
b3687f2b25 don't decode signature headers
Fixes https://pagure.io/koji/issue/2221

some headers, like sigmd5, are inherently binary
2020-05-25 09:14:51 +02:00
Alex Iribarren
2087561fe6 Correctly identify "hostname doesn't match" errors 2020-05-20 10:50:56 +02:00
Yu Ming Zhu
21ff8143c4 warning for both cli and config file option 2020-05-18 09:29:04 +02:00
Yu Ming Zhu
80cf5ac94a deprecated warning for cli option --ca as well
fixes: #2182
2020-05-18 09:29:04 +02:00
Tomas Kopecek
0e5b54f32d cli: deprecate --ca
Fixes: https://pagure.io/koji/issue/2182
2020-05-13 10:45:37 +02:00
Tomas Kopecek
0132313f92 replace logging.warn with warning
call is deprected in python 3.7

Fixes: https://pagure.io/koji/issue/2135
2020-04-22 13:47:15 +02:00
Owen W. Taylor
3227462528 koji.ClientSession: fix erroneous conversion to latin-1
For Python 3, we need to always encode what we are sending to the server as
utf-8; encoding strings that have only latin-1 as latin-1 causes us to
send something that the server can't parse. (When no encoding is specified
xmlclient.client.dumps creates an XML document with an xml declaration
for UTF-8.)
2020-03-25 09:54:11 +01:00
Ken Dreyer
19dabc0eda client: use default CA store during client auth if serverca is unset
Prior to this change, if the following conditions were true:

1) A Koji client uses SSL authentication,
2) The user does not set the "serverca" option for their profile,
3) The user does not have a "~/.koji/serverca.crt" file present,

Then Koji did not use the default CA store to validate the hub's CA.
read_defaults() was setting the "serverca" value to an empty string ""
in these cases. This led to an AuthError in ssl_login() for the empty
string:

  raise AuthError("Server CA %s doesn't exist or is not accessible" % serverca)

Update ssl_login() to ignore empty strings in this case, treating them
the same as None.

The code in _sendOneCall() already checks this value in a similar way,
with "if verify:", so we're matching that behavior here.

With this change, Koji clients will fall back to using the default CA
store.
2020-03-11 13:33:39 +01:00
Yuming Zhu
cf34706f04 use Exception instead of BaseException for bare expection 2020-03-03 21:38:22 +08:00
Yuming Zhu
2a2c5cb729 flake8: apply W rules (prefering W503) 2020-03-03 21:38:22 +08:00
Yuming Zhu
c5db34a8e1 flake8: apply E501 with max-line-length=99 2020-03-03 21:38:22 +08:00
Yuming Zhu
f1ba6cefd7 flake8: apply all rest E7 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
6ed30954b2 flake8: apply E71x rule 2020-03-03 21:38:22 +08:00
Yuming Zhu
6dd77e0fa4 flake8: apply E502 rule 2020-03-03 21:38:22 +08:00
Yuming Zhu
0f727a2ab4 flake8: apply E3 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
05340b146b flake8: apply E2 rules except E266 2020-03-03 21:38:21 +08:00
Yuming Zhu
ce1f9928af flake8: apply E1 rules 2020-03-03 21:38:21 +08:00
Yuming Zhu
97cfaa4fcf flake8: follow E265 rule 2020-03-03 21:35:08 +08:00
Yuming Zhu
642508ccf6 flake8: follow all F rules 2020-03-03 21:35:08 +08:00
Tomas Kopecek
344f00a2a5 move _apidoc cache to session
Fixes: https://pagure.io/koji/issue/1533
2020-02-25 10:24:55 +01:00
Till Maas
cdf63326c7 Add doc string for virtual methods 2020-02-25 10:24:55 +01:00
Tomas Kopecek
72b4c0c3e2 deprecation of krb_login
Fixes: https://pagure.io/koji/issue/1906
2020-02-19 14:15:17 +01:00
Tomas Kopecek
d6f2db6325 fix potentially undeclared variable error
Fixes: https://pagure.io/koji/issue/1957
2020-02-18 11:54:11 +01:00
Jon Schlueter
779a8bae08 Add _taskLabel entry for indirectionimage
v2: cleanup whitespace and drop extra line from debugging
2020-02-12 10:54:38 +01:00
Miro Hrončok
388bb070f1 Always use stream=True when iterating over a request
Fixes https://pagure.io/releng/issue/9226
2020-02-12 10:42:12 +01:00
Tomas Kopecek
8c0bedeeb5 added koji exceptions
Fixes: https://pagure.io/koji/issue/290
2020-01-02 10:45:48 +01:00
Mike McLean
2ff52c0dc3 refactor 2020-01-02 10:45:48 +01:00
Patrick Uiterwijk
5b2e901d2e Add a sanity check on remotely opened RPMs
This should catch issues with downloading RPMs early, so as to not break
the build in unknown ways.

Fixes: #290
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2020-01-02 10:45:48 +01:00
Yuming Zhu
666111575b do not use with statement with requests.get
fixes: #1530
2019-12-23 10:00:21 +01:00
Tomas Kopecek
0e5042832d split admin_emails option in koji.add_mail_logger
If there are multiple e-mailes separated by comma of space, they should
be split for correct usage of smtplib.sendmail.

Fixes: https://pagure.io/koji/issue/1240
2019-12-19 10:31:58 +01:00
Yu Ming Zhu
5b83c682e4 remove unused imports 2019-12-12 11:00:58 +00:00
Yu Ming Zhu
558f7be2d2 fix newline betwwen koji and relative imports 2019-12-12 11:00:58 +00:00
Yu Ming Zhu
4d29a87e9b sort imports in koji 2019-12-12 11:00:57 +00:00
Mike Bonnet
be31305f52 include CHECKSUM_TYPES in kojikamid.py, and use it when validating checksums of downloaded files
The Koji data model has been updated to support multiple checksum types. These are listed in the
CHECKSUM_TYPES enum in koji/__init__.py, but are not available in kojikamid.py. This change
copies the Enum class and the CHECKSUM_TYPES enum into kojikamid at build time, and uses it when
validating the checksums of downloaded files.
2019-11-27 16:42:24 +01:00
Tomas Kopecek
aad9fac8d9 move from urrlib.request.urlopen to requests.get
Fixes: https://pagure.io/koji/issue/1530
2019-11-25 11:31:08 +01:00
Tomas Kopecek
8920d9d613 drop compatrequests variant 2019-11-25 11:31:08 +01:00
Patrick Uiterwijk
52f896c602 Implement openRemoteFile with requests or compatrequests
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2019-11-25 11:31:08 +01:00
Yu Ming Zhu
f7f1c65bea raise error when config search paths is empty
also fix unittest: test_profiles

notes: since the test won't read config files anymore, lift the loop number from 20 -> 256 to increase the probability of hitting the multithread issue

fixes: #1786
2019-11-22 08:43:44 +01:00
Yu Ming Zhu
22951f7f9d fix typos for GenericError 2019-11-18 10:05:59 +01:00
Tomas Kopecek
ed4bd28b78 include profile name in prased config options
Fixes: https://pagure.io/koji/issue/1522
2019-11-14 09:54:21 +01:00
Tomas Kopecek
e11ad814af make rpm import optional in koji/__init__.py
Fixes: https://pagure.io/koji/issue/1772
2019-11-12 10:03:06 +01:00
Yu Ming Zhu
31a2670575 check ConfigParser object rather than config path list
fixes: #1763
2019-11-08 15:15:33 -05:00
Yuming Zhu
b2b8d5f9cc strict per item in config_files 2019-10-15 09:14:16 +02:00
Yu Ming Zhu
4c1928f377 extract read_config_files util for config parsing 2019-10-15 09:14:16 +02:00
Yu Ming Zhu
2034695e88 add an option to set server realm for all clients 2019-10-10 16:37:56 +02:00
Yu Ming Zhu
831f0dfdaf cli: fix moshimoshi for krbLogin 2019-10-10 16:37:56 +02:00
Tomas Kopecek
327c23d072 Use bytes for debug string
Fixes: https://pagure.io/koji/issue/1656
2019-10-10 12:39:17 +02:00
Yuming Zhu
2956319c39 update docstr and do not swallow other errno 2019-09-30 15:33:01 +02:00
Yu Ming Zhu
589eb2dc9c [lib] ensuredir: normalize directory and don't throw error when dir exists 2019-09-30 15:33:01 +02:00
mprahl
a552a248db Allow ClientSession objects to get cleaned up by the garbage collector
Fixes #1652
2019-09-20 11:51:44 -04:00