Commit graph

860 commits

Author SHA1 Message Date
Ken Dreyer
3ff8eef322 add "NoSuch" custom exceptions
Add more custom exception classes. This will allow to programmatically
determine the error causes from complex RPCs.

This commit simply defines the new classes and fault codes. Nothing in
Koji's codebase uses these exceptions yet. We'll begin to raise these
exceptions after this is widely deployed for clients in the field.
2022-02-10 15:44:04 +01:00
Ken Dreyer
1e00081991 refactor exceptions to koji.exceptions
Move Koji's custom exceptions classes to a dedicated koji.exceptions
library. This organizes the code so it's easier to maintain, and matches
patterns in other well-known projects, like requests.exceptions or
cryptography.exceptions.
2022-02-10 15:44:04 +01:00
Jana Cupova
968eb61055 Fix makedirs for existing dirs
Fixes: https://pagure.io/koji/issue/3097
2022-02-07 15:04:34 +01:00
Tomas Kopecek
06b5f7c188 Hide sensitive values in urrlib3 exceptions
Fixes: https://pagure.io/koji/issue/2801
2022-02-07 11:10:19 +01:00
Jana Cupova
c1920b330a Write signed copies atomically
Fixes: https://pagure.io/koji/issue/3097
2022-02-07 10:12:57 +01:00
Tomas Kopecek
6aaa6b3248 rename option 2022-02-07 10:07:26 +01:00
Tomas Kopecek
e7db7d8b53 db: logging option for cursor
In some cases we expect query to fail (LOCK NOWAIT) but it still
clutters the logs. Option for not logging cursor-level errors.

Fixes: https://pagure.io/koji/issue/2837
2022-02-07 10:01:21 +01:00
Tomas Kopecek
3ee95baa5f mock.module_setup_commands tag extra option
Fixes: https://pagure.io/koji/issue/2483
2022-02-07 09:33:14 +01:00
Jana Cupova
725c157fbd Allow password in SCM url with new builder option
Fixes: https://pagure.io/koji/issue/3179
2022-01-25 15:47:27 +01:00
Tomas Kopecek
44378d767f Release notes 1.27.1
Related: https://pagure.io/koji/issue/3191
2022-01-13 09:44:05 +01:00
Ken Dreyer
eaa5bf9add lib: rename inner error variable in is_conn_err()
Rename this variable to something easier to understand.
2022-01-11 12:32:52 +01:00
Ken Dreyer
1cc6c79157 lib: refactor errno list in is_conn_error()
Move the copy-and-pasted list of errnos into a variable and use that in
both places. This makes this code easier to understand.
2022-01-11 12:32:52 +01:00
Yuming Zhu
969f102598 [hub] only raise error when authtype is not proxyauthtype
fixes: #3163
2021-12-15 15:04:20 +01:00
Jana Cupova
74ac826a87 Add limits on name values
Fixes: https://pagure.io/koji/issue/2117
2021-12-09 07:11:57 +01:00
Tomas Kopecek
cda6439a91 Koji 1.27 release notes
Fixes: https://pagure.io/koji/issue/3127
2021-11-18 11:28:33 +01:00
Jana Cupova
2118a24e7a Kojira throw exception when auth failed
Fixes: https://pagure.io/koji/issue/2852
2021-11-07 11:06:27 +00:00
Tomas Kopecek
9e6be3f977 lib: Deprecate koji.listFaults
Related: https://pagure.io/koji/issue/3071
2021-11-07 09:37:18 +00:00
Tomas Kopecek
a6aeaee3e3 fix callMethod 2021-11-04 12:07:05 +00:00
Tomas Kopecek
09a8fd71e5 backward compatibility for older hub
use proxyauthtype only if it is explicetly requested. Older hubs
don't know this option and will refuse login attempt.
2021-11-04 12:07:05 +00:00
Tomas Kopecek
038a2f1850 rename ProxyAuthType -> AllowProxyAuthType 2021-11-04 12:07:05 +00:00
Tomas Kopecek
252121c11f propagate proxyauthtype in login calls 2021-11-04 12:07:05 +00:00
Tomas Kopecek
ac8e83e3ac conditional evaluation of proxyauthtype 2021-11-04 12:07:05 +00:00
Tomas Kopecek
24e5c0cb45 further fixes (will be squashed before merge) 2021-11-04 12:07:05 +00:00
Tomas Kopecek
b6ccafafeb proxyauthtype for web users 2021-11-04 12:07:05 +00:00
Tomas Kopecek
d43b9494c5 proxy login method 2021-11-04 12:07:05 +00:00
Jana Cupova
6426ddced1 Allow user on git://, git+http://, git+https://, and git+rsync:// scheme
Fixes: https://pagure.io/koji/issue/2868
2021-10-26 11:14:40 +02:00
Jana Cupova
32b5377392 Remove translation stub functions
Fixes: https://pagure.io/koji/issue/3072
2021-10-21 13:25:16 +02:00
Tomas Kopecek
ba2e1e520b basic security checks with bandit
Fixes: https://pagure.io/koji/issue/3042
2021-10-20 15:20:14 +02:00
Ken Dreyer
0747714f6e document convertFault method
Update the convertFault docstring to describe how the method converts
faults, the "fault" parameter type, and possible return values.
2021-10-12 14:27:39 -04:00
Tomas Kopecek
b8d486e637 Release notes 1.26.1
Fixes: https://pagure.io/koji/issue/3052
2021-09-29 11:06:19 +02:00
Tomas Kopecek
a626d818a2 fix typo 2021-09-15 12:43:06 +02:00
Patrick Uiterwijk
af25fc2e24 Support packages that are head-signed
This supports packages which do not have the RPMv3 signature scheme
(over the full RPM header+payload), but instead only have signatures
over the header (v4 scheme).
For the v4 scheme, the signature is only stored in SIGTAG_RSA (or
SIGTAG_DSA).

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
2021-09-15 12:43:06 +02:00
Tomas Kopecek
7a4b17005a expose force_auth in config 2021-09-14 13:26:11 +02:00
Tomas Kopecek
1e5f0ef745 Release notes 1.26
Fixes: https://pagure.io/koji/issue/2983
2021-08-23 11:09:41 +02:00
Yu Ming Zhu
bc272c0532 [doc][defining_hub_policies] update the doc 2021-08-18 09:47:10 +00:00
Yu Ming Zhu
cdbebd963d [hub] add non-host evalPolicy API 2021-08-16 17:55:26 +00:00
Yu Ming Zhu
601cd33902 use scm_ as the prefix instead of scm for scminfo 2021-08-16 17:55:26 +00:00
Yu Ming Zhu
a3f19e0f12 more reasonable parameter name, and more doc strs 2021-08-16 17:55:26 +00:00
Yu Ming Zhu
47c4b5d70b kojid: extend SCM.assert_allowed with hub policy
This is a simple extention of `SCM.assert_allowed`

- `assert_allowed_by_policy` will set the default "use_common" to False which is different to the old behavior
- `channel`, `user_id`, `scratch` are passed in the `policy_data` with scminfo right now.

This is a prototype for this change, and there are some other solutions could be implemented too

- Use a scmpolicy plugin as `postSCMCheckout` callback, the pro is that we can do more checks after the source is initialized on builder, meanwhile, the con is that the source will be downloaded even it is denied by policy. It might be a potential risk?
- Do the scm check in hub's `make_task`, this looks straightforward, but may lack some builder's information

fixes: #2757
2021-08-16 17:55:26 +00:00
Tomas Kopecek
258831d7e6 Revert "PR#2978: Don't take new tasks if we've 0.0 capacity available"
This reverts commit 5e9ca9366a, reversing
changes made to 59879c6e2c.
2021-08-16 13:34:54 +02:00
Tomas Kopecek
a537521ecd Don't take new tasks if we've 0.0 capacity available
If I've just started buildArch task with weight 1.5 on builder with 1.5
capacity, it can pick another one, as it is not over the builder's
capacity. This is wrong as there is no real capacity behind.
2021-08-11 12:43:12 +02:00
Tomas Kopecek
44c89e3516 DBConnectionString/dsn option for db connection
Alternative DSN connection string fro connecting to postgres. Allow us
to specify e.g. sslmode without adding separate DB* options.

Fixes: https://pagure.io/koji/issue/2838
2021-07-20 11:49:06 +02:00
Tomas Kopecek
bdb9f91890 Release notes 1.25.1
Fixes: https://pagure.io/koji/issue/2920
2021-07-01 08:58:46 +02:00
Tomas Kopecek
d53c3f88fa lib: return taskLabel for unknown tasks
"malformed task" has been returned for everything unknown, but external
plugins can create completely valid tasks which we can't parse without
those plugins. In such case we want to return at least method/arch info.

Related: https://pagure.io/koji/issue/2904
2021-06-09 14:44:04 +02:00
Jana Cupova
9541c2a173 importlib instead of imp
Fixes: https://pagure.io/koji/issue/2822
2021-06-02 11:19:33 +02:00
Tomas Kopecek
3598562883 Release notes 1.25
Fixes: https://pagure.io/koji/issue/2845
2021-05-20 12:59:39 +02:00
Jana Cupova
de008b5f27 Add kerberos debug message
Fixes: https://pagure.io/koji/issue/2063
2021-05-03 13:41:35 +02:00
Tomas Kopecek
6e3553459f lib: is_conn_error catch more exceptions
Related: https://pagure.io/koji/issue/2789
2021-04-28 13:34:40 +02:00
Tomas Kopecek
ef3e2cd04b lib: use parse_task_params for taskLabel
Fixes: https://pagure.io/koji/issue/2519
2021-04-26 14:43:20 +02:00
Tomas Kopecek
290e1ddf31 lib: more portable BadStatusLine checking
Fixes: https://pagure.io/koji/issue/2789
2021-04-13 13:26:10 +02:00