Commit Graph

2817 Commits

Author SHA1 Message Date
Wolfgang Bumiller
2d4050825d sys: don't duplicate the template path
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 11:06:25 +02:00
Lukas Wagner
88731c52f0 rrd: add api-types
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
7ea63a6fb9 rrd: try to load database if not already present in cache
Before, a call to `update` was necessary to load an existing database
into the cache. If `update` was never called, `extract_cached_data`
would simply return no data.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
f01c1e0ce9 rrd: cache: add update_value_ignore_old
This function is the same as the regular `update_value`, but it
sets the `new_only` flag when updating the value in the rrd map.
This avoids "time in past" messages being logged in case a data point
happens to be added twice. This new function will just silently reject
values that have an older timestamp than the most recent one.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
4ca2e01442 rrd: deprecate create_pbs_default_rrd
This one should be in the client code.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
846e85ed2e cache: add benchmark example
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
0febb5045a cache: add new crate 'proxmox-shared-cache'
This crate contains a file-backed, rotating cache.
The cache should be safe to be accessed from multiple processes at
once.

The cache stores the value at the provided path.
If `keep_old` is >0, the cache will keep up to `keep_old` versions
around which can be queried via the `get_last` method.
The value and its history are stored in the same file,
each generation represented by a single line of JSON.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Lukas Wagner
2b6ecfd38d sys: add make_tmp_dir
Under the hood, this function calls `mkdtemp` from libc. Unfortunatly
the nix crate did not provide bindings for this function, so we have
to call into libc directly.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-09 11:01:30 +02:00
Wolfgang Bumiller
83c5ced7a9 sys: get rid of a try_block
by skipping over a utf8 scheck (serde_json can take a byte slice
already via `from_slice()`)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 09:13:39 +02:00
Wolfgang Bumiller
b266779ec0 sys: drop unused proxmox-time dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 09:11:17 +02:00
Maximiliano Sandoval
642db84474 auth-api: docs: remove wrong return info
The method returns a boolean.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
920fc41b2f server: docs: fix unresolved link to systemd_notify
Fixes the cargo docs warning:

warning: unresolved link to `systemd_notify`
   --> proxmox-daemon/src/server.rs:314:6
    |
314 | /// [systemd_notify] with [SystemdNotify::Ready](proxmox_systemd::notify::SystemdNotify) when the
    |      ^^^^^^^^^^^^^^ no item named `systemd_notify` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
c8352531e4 serde: docs: escape html tags
Fixes the cargo docs warning:

warning: unclosed HTML tag `u8`
  --> proxmox-serde/src/lib.rs:55:18
   |
55 | /// Serialize Vec<u8> as base64 encoded string.
   |                  ^^^^
   |
   = note: `#[warn(rustdoc::invalid_html_tags)]` on by default
help: try marking as source code
   |
55 | /// Serialize `Vec<u8>` as base64 encoded string.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
2794c137d5 login: docs: fix typo and add escape html tags
Fixes the cargo docs warning:

warning: unclosed HTML tag `username`
  --> proxmox-login/src/api.rs:35:47
   |
35 |     /// realm is simply added to the username <username>@<relam>.
   |                                               ^^^^^^^^^^
   |
   = note: `#[warn(rustdoc::invalid_html_tags)]` on by default

warning: unclosed HTML tag `relam`
  --> proxmox-login/src/api.rs:35:58
   |
35 |     /// realm is simply added to the username <username>@<relam>.
   |                                                          ^^^^^^^

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
f80cb33993 ldap: docs: turn uri into link
Fixes the following cargo doc warning:

warning: this URL is not a hyperlink
   --> proxmox-ldap/src/lib.rs:199:9
    |
199 |     /// https://www.rfc-editor.org/rfc/rfc4512#section-5.1
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.rfc-editor.org/rfc/rfc4512#section-5.1>`
    |
    = note: bare URLs are not automatically turned into clickable links
    = note: `#[warn(rustdoc::bare_urls)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
0c889ff2da client: docs: remove redundant link
Fixes the cargo doc warnings:

warning: redundant explicit link target
 --> proxmox-http/src/client/mod.rs:4:19
  |
4 | //! in [`Client`](crate::client::Client).
  |         --------  ^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
  |         |
  |         because label contains path that resolves to same destination
  |
  = note: when a link's destination is not specified,
          the label is used to resolve intra-doc links
  = note: `#[warn(rustdoc::redundant_explicit_links)]` on by default
help: remove explicit link target
  |
4 | //! in [`Client`].
  |        ~~~~~~~~~~

warning: redundant explicit link target
 --> proxmox-http/src/client/mod.rs:7:22
  |
7 | //! [`sync::Client`](crate::client::sync::Client).
  |      --------------  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
  |      |
  |      because label contains path that resolves to same destination
  |
  = note: when a link's destination is not specified,
          the label is used to resolve intra-doc links
help: remove explicit link target
  |
7 | //! [`sync::Client`].
  |     ~~~~~~~~~~~~~~~~

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
fe7f37e9b3 property_string: clippy: define bound once
Fixes the clippy lint:

warning: bound is defined in more than one place
   --> proxmox-schema/src/property_string.rs:352:14
    |
352 | pub fn parse<T: ApiType>(value: &str) -> Result<T, Error>
    |              ^
353 | where
354 |     T: for<'de> Deserialize<'de>,
    |     ^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
    = note: `#[warn(clippy::multiple_bound_locations)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
77fe0f6954 docs: clippy: add indentation to doc list items
Fixes the clippy warning:

warning: doc list item missing indentation
   --> proxmox-subscription/src/subscription_info.rs:179:9
    |
179 |     ///  (this mode is used to decide whether to refresh the subscription information)
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
    = note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
    |
179 |     ///   (this mode is used to decide whether to refresh the subscription information)
    |          +

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Maximiliano Sandoval
7052972212 apt: clippy: don't clone types implementing Copy
Fixes the clippy warnings:

warning: `proxmox-apt` (lib) generated 1 warning
warning: using `clone` on type `Option<[u8; 32]>` which implements the `Copy` trait
   --> proxmox-apt/tests/repositories.rs:117:22
    |
117 |     let old_digest = file.digest.clone().unwrap();
    |                      ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `file.digest`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: using `clone` on type `[u8; 32]` which implements the `Copy` trait
   --> proxmox-apt/tests/repositories.rs:135:24
    |
135 |     file.digest = Some(old_digest.clone());
    |                        ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `old_digest`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Wolfgang Bumiller
c3713cffe5 api-macro: fix warnings in tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:23:38 +02:00
Wolfgang Bumiller
a7ab26a9d8 http-error: fix a warning in tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:22:25 +02:00
Wolfgang Bumiller
15c64a5d00 api-macro: bump to 1.1.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:15:57 +02:00
Wolfgang Bumiller
451d3b0adf section-config: bump to 2.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:15:34 +02:00
Wolfgang Bumiller
839f508f55 api-macro: type-key support for derived enums
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
4a154b3cb5 section-config: support a type_key property
For when the underlying datatype is supposed to contain the type
property and the schema does not mark it as optional.

The use case here is to support flat `Remote` type where the "type" of
pve/pmg/pbs is a property which is present in the `Remote` struct
while being derived from the section type.

This will implicitly include and strip the type of the json object
after/before de/serializing.

Alternatives would be
- to mark the type as optional and just fill it out later when loading
  the data, but that is technically wrong...
- have a 2nd version of the struct with the type field removed and
  From/Into implemented, but that's even more unwieldy.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
4d96aa52d2 section-config, api-macro: add SectionConfig enum support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
51d78fdd2b api-macro: handle renames in updater derive
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
4c37db22d2 sys: bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:33 +02:00
Wolfgang Bumiller
1cb2bf85ba sys: bump to 0.6.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 13:50:57 +02:00
Fabian Grünbichler
d0dab46539 sys: make fd::cwd crate-internal
it's not used by anything outside of proxmox-sys.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-08-06 13:37:36 +02:00
Fabian Grünbichler
dc0b9dec4a sys: adapt to IO Safety changes in rustc
`OwnedFd`s are now (rustc 1.80+) checked for validity when dropped in a debug
build, to catch usage after closing. Unfortunately those checks don't account
for the special value `AT_FDCWD` (-100) which is not a "real" FD, but a magic
constant used by many libc functions to signify operations starting at the
current working directory.

changing our `cwd` helper to open the CWD for real, instead of just returning
the magic value that pretends to be an FD, works around those limitations with
the least API churn.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-08-06 13:37:34 +02:00
Wolfgang Bumiller
9d921901d3 rest-server: update examples code to daemon split
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-01 10:27:44 +02:00
Wolfgang Bumiller
bedbaae252 router: bump to 2.2.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-31 10:08:25 +02:00
Wolfgang Bumiller
65715bc096 io, serde, schema: doc fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-30 16:16:16 +02:00
Wolfgang Bumiller
ffd45c642f http: replace deprecated io_err_other
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-30 16:11:44 +02:00
Wolfgang Bumiller
482fd62423 io: drop the valgrind support code
valgrind-request is currently not packaged and we haven't used this in
a while...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-30 16:09:09 +02:00
Fabian Grünbichler
a44fda92ef bump proxmox-log to 0.2.1-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-07-29 09:27:18 +02:00
Wolfgang Bumiller
7c403de278 lang: d/control bump
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 13:23:53 +02:00
Wolfgang Bumiller
a7ba12d0b8 lang: bump to 1.4.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 13:13:29 +02:00
Wolfgang Bumiller
e3a5ff78f4 async, sys: replace deprecated io_err_other
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 13:09:33 +02:00
Wolfgang Bumiller
ce0b21805c lang: deprecate io_err_other
For regular error cases, `std::io::Error` can now also box errors and
provides an `Error::other()` function since rust 1.74.

For the case where it was used directly with strings
(io_err_other("string")) -> that's what `io_format_err!()` and
`io_bail!()` are for.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 12:14:03 +02:00
Wolfgang Bumiller
ea3c37fd36 sys: drop unused import
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 12:14:03 +02:00
Wolfgang Bumiller
034bb9cdda router: cli: add OutputFormat enum api type
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 11:46:33 +02:00
Wolfgang Bumiller
dd36fec23d sys: replace CStr::from_bytes_... with c"literals"
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-26 11:46:33 +02:00
Maximiliano Sandoval
ba304a4f83 compression: make Deflate{De, En}coderBuilder public
These structs are returned by the public method
`Deflate{En,De}coder::builder`.

Reported-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-26 11:43:01 +02:00
Wolfgang Bumiller
2598699fcb daemon: remove useless comment
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 16:30:14 +02:00
Wolfgang Bumiller
35372b5337 daemon: boxed FnOnce has been usable for a while
While technically an API break, we don't use the public API for this
anywhere and the trait we're changing is explicitly marked as
`#[doc(hidden)]`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 16:27:32 +02:00
Wolfgang Bumiller
4502bc3b73 acme-api: bump to 0.1.4-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:33:36 +02:00
Wolfgang Bumiller
150f203209 auth-api: bump to 0.4.4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:32:28 +02:00
Wolfgang Bumiller
15200b9f64 rest-server: bump to 0.7.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:32:01 +02:00