Commit Graph

2550 Commits

Author SHA1 Message Date
Thomas Lamprecht
4197e94e25 rest-server: better document task-log archive rotation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-26 10:13:45 +02:00
Thomas Lamprecht
c8a0ba04ca sys: depreacate PTY module, moves to termproxy directly
As termproxy only used this module from the huge proxmox-sys crate,
and this module was also only used here, it makes sense to move it
over there (and dropping proxmox-sys halved build-time from 8.5 s to
4.2 s).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-24 13:52:16 +02:00
Gabriel Goller
c1c062bf56 schema: beautify parameter error output
If there is only one error, output in a single line, without any
excessive newlines at the end. If there are multiple errors, show them
in a bulleted list.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-10-23 17:40:34 +02:00
Dietmar Maurer
34e86078c2 proxmox-tfa: derive Copy, Clone and PartialEq on TfaType (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-23 11:44:45 +02:00
Dietmar Maurer
c1819c2549 DailyDuration: derive PartialEq (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-20 12:01:27 +02:00
Thomas Lamprecht
1e64feeaad rest-server: factor out task-log directory and creation
We had two call sites deriving the directory "shard" where the task
log file is actually saved to, this can lead to ugly bugs and is
better done in a central single-source-of-truth way.

While at it factor out the creation of the log file (and it's shard
directory) to avoid crowding the WorkerTask new fn to much.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-10-18 19:36:37 +02:00
Wolfgang Bumiller
45152c5e3e bump proxmox-client to 0.3.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 13:27:13 +02:00
Wolfgang Bumiller
2c9c43ca4c human-byte: d/control bump
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 13:04:48 +02:00
Wolfgang Bumiller
f47ad56812 bump proxmox-human-byte to 0.1.2
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 13:03:12 +02:00
Dietmar Maurer
83af1cdce4 HumanByte: make fields public
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-10-16 12:27:54 +02:00
Wolfgang Bumiller
9e8f90e667 tfa: more optional dependency cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 09:00:18 +02:00
Wolfgang Bumiller
6940908a8a tfa: make totp a feature and mark all optional deps as optional
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 08:58:09 +02:00
Wolfgang Bumiller
1a6f1efe63 workspace: set resolver to 2 to silence a warning
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-16 08:53:35 +02:00
Wolfgang Bumiller
7e6aa2733a replace deprecated X509Extension::new_nid
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-10-03 13:45:10 +02:00
Fabian Grünbichler
04e2d0e5c3 bump proxmox-api-macro to 1.0.6-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-10-03 09:37:01 +02:00
Fabian Grünbichler
c83627b1a6 bump proxmox-sortable-macro to 0.1.3-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-10-03 09:37:01 +02:00
Fabian Grünbichler
4fd7359677 bump proxmox-router to 2.1.1-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-10-02 09:25:10 +02:00
Wolfgang Bumiller
b232b580a0 update to syn 2
This mostly affected attribute parsing (due to the syn::Meta changes).
Also creating `DelimSpan`s for custom-built `syn::Attribute`s is a
bit... ugly.
Upshot: turns out we can drop some helpers in util.rs with the new
`syn::Meta` changes.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-09-29 13:52:21 +02:00
Wolfgang Bumiller
eb1abe45b6 router: bump env_logger to 0.10 and move to workspace
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-09-28 09:59:48 +02:00
Dominik Csapak
9fa4185196 client: fix optional data for errors
previously we changed the internal type of the 'data' property
from Option<T> to T in the assumption the api always returns
'data:null'.

this is actually only the case when the api call succeeds. in an error
case there is no data property at all.

to fix this issue while behaving the same for 'data:null' we have to
revert to Option<T> for RawApiResponse but instead of always throwing an
error for 'data:null' in 'check' we now try there to deserialize from
Value::Null for T if there was no data. This will succeed for the Type
'()' which was the motivation for the original change.

The only downside is that the RawApiResponse now has a trait bound that
T is deserializeable, but was a requirement for using it anyway
(as there was no other way of constructing it)

Fixes: 271a55f ("client: remove option from inner RawApiResponse")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-09-27 11:27:47 +02:00
Thomas Lamprecht
dc9ee73751 schema: bump version to 2.0.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-20 11:46:02 +02:00
Gabriel Goller
bcdcb181ee fix #4162: sys: added auto-submitted header to email body
`Auto-Submitted` is defined in the rfc 5436 [1] and describes how
an automatic response (f.e. ooo replies, etc.) should behave on the
emails. When using `Auto-Submitted: auto-generated` (or any value
other than `none`) automatic replies won't be triggered.

[1]: https://www.rfc-editor.org/rfc/rfc3834.html

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-09-18 16:41:06 +02:00
Dominik Csapak
359da67e9b rest-server: accept empty body as valid parameters
technically an empty string is not valid json, but when sending an api
request without any parameters, treating the empty body as an empty
parameter hash instead of an error, makes the the api more robust for
clients

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-09-07 18:12:51 +02:00
Hannes Laimer
92be86d776 schema: serialize enum unit variants
... since deserializing them already works

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2023-09-07 17:29:36 +02:00
Thomas Lamprecht
498341ec0d apt: bump version to 0.10.6-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-05 15:29:49 +02:00
Thomas Lamprecht
fb90d53caf apt: use modern format string variables and small style cleanups
note: not complete, there's other code to check and rework, but I had
this already done so commit it, better than nothing.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-05 15:19:38 +02:00
Thomas Lamprecht
4e2cc6fd53 tests: factor out directory cleanup+creation
This moves the clean-up to happen up-front. That way one can still
inspect the test data after, e.g., a failed test.

Originally done almost like this in a patch from Fiona [0] that I just
overlooked, but now also factored out, avoid crowding the test code to
much with duplicate code.

[0]: https://lists.proxmox.com/pipermail/pve-devel/2023-June/057136.html

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-05 15:15:46 +02:00
Thomas Lamprecht
195e9e1cdf apt: fixup description for Reef repo
the "main" repo only exists for Quincy to allow an easier transition
from Proxmox VE 7 to Proxmox VE 8, for when the enterprise repo got
added for ceph too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-05 10:09:00 +02:00
Thomas Lamprecht
1e47036528 apt: add Ceph Reef to standard repo list
For now just duplicate the Ceph Quincy entries, as I want to avoid
using macros and we do not yet have support for enums inside enums
with the api macro.

Adapt and expand the tests slightly to have at least some simple
coverage there too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-04 17:58:45 +02:00
Thomas Lamprecht
767582a2eb apt: unify match-arm for ceph sources.list location
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-04 17:58:45 +02:00
Thomas Lamprecht
ae3c04a76b apt: tests: allow re-running digest test without clean-up
Files inside CARGO_TARGET_TMPDIR are only cleaned on `cargo clean`, so
tests that expect files to not exist need to cleanup themselves.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-04 17:58:45 +02:00
Lukas Wagner
bcd134a349 sys: fs: move tests to a sub-module
This ensures that test code is not compiled in regular builds

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-30 17:37:31 +02:00
Dominik Csapak
299a478f15 proxmox-time: implement epoch_to_rfc3339 for wasm
we just printed out the UTC version, this implements a localized version

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-08-30 09:20:38 +02:00
Dominik Csapak
151e2cfdfd time: make RFC3339 format in wasm conform to usual format
on other targets we print the timestamp without fractional seconds
('.xxxZ'), so we should remove that too on wasm

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-08-30 09:18:44 +02:00
Dominik Csapak
271a55f187 client: remove option from inner RawApiResponse
when using the client for an api call that does not return any data
(it returns '{"data":null}'), we would always get an error 'api returned
no data'. The message is technically correct, but it should not be an
error when we expect no data (e.g. most of our CRUD PUT/POST calls)

instead of having the Option<T> in the RawApiResponse type itself, move
it into to the 'nodata' function intended for api calls where we don't
expect any data.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-08-29 14:14:52 +02:00
Dietmar Maurer
022fdacb25 proxmox-client: add post_without_body
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-08-27 16:19:31 +02:00
Lukas Wagner
d49fc1aa2f notify: make template rendering helpers more robust
This commit has the aim of making template rendering a bit more
robust. It does so by a.) Accepting also strings for helpers that
expect a number, parsing the number if needed, and b.) Ignoring errors
if a template helper fails to render a value and showing an error in
the logs, instead of failing to render the whole template (leading
to no notification being sent).

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-25 15:32:34 +02:00
Wolfgang Bumiller
c81068097b bump proxmox-client to 0.2.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-25 09:03:00 +02:00
Wolfgang Bumiller
8617442560 client: fixup checks for api calls not returning data
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-25 09:03:00 +02:00
Wolfgang Bumiller
f20f9bb9f7 client: set content type header on requests
this got lost with the recent refactoring

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-25 08:56:41 +02:00
Wolfgang Bumiller
6286ff4eeb bump proxmox-client to 0.2.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-25 08:37:25 +02:00
Wolfgang Bumiller
d7f6fc4db5 client: fix content type parsing with included charset
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-25 08:36:19 +02:00
Max Carrara
1f351625a5 async: runtime: Modernise module and update docs
This commit updates all helper functions, taking into account recent
developments regarding `tokio`.

In particular, the `block_in_place()` and `block_on()` functions now
don't panic anymore if used within the single-threaded `tokio` runtime
and instead behave as expected in both runtime flavours.

Furthermore, because `tokio` may add more runtime flavours in the
future, all helpers will now panic if used within an unsupported
runtime. This is to prevent unforeseen behavioural quirks and
interactions with `tokio` internals.

The above changes make `BlockingGuard` redundant; it is consequently
removed.

The documentation is also updated, describing the behaviour of the
helper functions and the purpose of the `runtime.rs` module in more
detail.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
2023-08-23 09:51:52 +02:00
Max Carrara
ede73a6561 client/login: clippy fixes
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
2023-08-22 10:04:16 +02:00
Wolfgang Bumiller
68fe8baf95 bump proxmox-client to 0.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-16 14:33:01 +02:00
Wolfgang Bumiller
97025d4143 package proxmox-login 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-16 14:30:38 +02:00
Wolfgang Bumiller
a909d5789c client: convenience helper to get a serialized ticket
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-10 14:33:55 +02:00
Wolfgang Bumiller
490008d596 client: expose AuthenticationKind
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-10 14:27:31 +02:00
Wolfgang Bumiller
bea97ccce1 client: add Client::set_authentication method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-10 14:14:06 +02:00
Wolfgang Bumiller
2fd5502321 bump proxmox-client to 0.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-10 11:15:36 +02:00