Commit Graph

2835 Commits

Author SHA1 Message Date
Maximiliano Sandoval
8d5e864bf1 sys: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
669c39c59f time: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
25f83bce19 rest-server: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
692231d2a4 subscription: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
6c0f6890e4 async: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
9693ceca7a dns-api: remove lazy-static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
9f9f736cfc cargo: set msrv to 1.80
In the following commits we make use of std::sync::LazyLock;

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Wolfgang Bumiller
cb509a1e6a client: bump to 0.4.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-13 15:45:20 +02:00
Wolfgang Bumiller
c54d5e06e6 client: change Token struct
API tokens between rust & perl code bases are inconsistent... this
needs fixing, but for now this is faster and more compatible.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-13 15:45:20 +02:00
Wolfgang Bumiller
9923f29622 section-config: bump to 2.1.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-13 15:45:20 +02:00
Wolfgang Bumiller
61d2eb891e section-config: make typed data usable with .with_type_key()
The original typed section config data would insert and remove the
type properties. With the introduction of `.with_type_key()` this is
done on the parse/write side instead, so we need to be able to opt out
of this.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-13 15:45:20 +02:00
Wolfgang Bumiller
88af4ca549 rrd: bump to 0.3.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 13:03:27 +02:00
Wolfgang Bumiller
01947a9802 shared-cache: bump to 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 12:59:09 +02:00
Wolfgang Bumiller
7c6701aab9 shared-cache: remove unused dependency on proxmox-schema
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 12:57:42 +02:00
Wolfgang Bumiller
c352cb87a0 shared-cache: group and sort dependencies
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 12:56:30 +02:00
Wolfgang Bumiller
fa3c7690e7 sys: bump to 0.6.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 12:53:44 +02:00
Wolfgang Bumiller
93d42ad488 rrd: rustfmt and style fix
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 11:20:15 +02:00
Wolfgang Bumiller
c66e5432e7 shared-cache: minor style adaptation
(more concise & readable)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-09 11:10:48 +02:00
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