Gabriel Goller [Tue, 10 Sep 2024 13:09:57 +0000 (15:09 +0200)]
log: print error if env-var parsing failed, print correct name
Print error if the parsing of the env-var fails on the proxmox-backup-*
daemons as well. Output correct env-var on binaries that use different
variables.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Gabriel Goller [Tue, 10 Sep 2024 13:03:51 +0000 (15:03 +0200)]
log: fallback to stderr if syslog not available
Don't panic when the syslog is not available - which happens commonly in
containers and sbuild environments (chroot and unshare) - instead
fallback to stderr.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com> Tested-by: Fiona Ebner <f.ebner@proxmox.com>
buildsys: add targets for raw installation and sysexts
The following targets should be self-explanatory:
# make install
$ make DESTDIR=$SOME_PATH install
# make proxmox-sys-install
$ make DESTDIR=$SOME_PATH proxmox-sys-install
# make proxmox-<any other crate name>-install
Additionally, these are used as building blocks to create
systemd-sysext(8) images:
$ make proxmox-sys-sysext
builds an `extensions/proxmox-sys.raw`
This can be copied/symlinked to `/run/extensions/` and then activated.
As root:
For the complete workspace, an `extensions/proxmox-workspace.raw` can
be built via
$ make sysext
This also takes a `CRATES` var to limit the crates which should be
included, and takes an optional `NOCLEAN=1` which prevents cleaning
out the previously installed to "add" new crates on the go:
Assuming there's a symlink like:
client: expose body, add generic request methods and streaming
The get/put/post/put_without_body/... methods now have a default
implementation forwarding to a generic `request` method as all our
implementations do the same already anyway.
Additionally, in order to allow easy access to a "streaming body", the
Body type is now exposed.
In the future, this crate may also require a wrapper to standardize
the handling of `application/json-seq` streams if we end up using
them, but for now, a simple way to expose the body is enough to get
going.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
router, rest-server: add StreamSync and StreamAsync API handlers
These are Iterators or Streams which continuously produce output. They
can either be formatted, in which they are serialized like the as
usually, or, if the client caccepts `application/json-seq` via an
`Accept` header, it will be streamed as a sequence directly.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
router, rest-server, api-macro: rename Streaming api to Serializing
This does not "stream", but rather skips the intermediate step to
serialize the entire output into a local json string.
We now reserve the "Stream*" prefix for actual *streaming*, that is,
producing an API response which gets streamed continuously as it is
asynchronously produced.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Gabriel Goller [Wed, 4 Sep 2024 13:28:56 +0000 (15:28 +0200)]
log: write to stderr when using init_cli_logger, export tracing::Level
Previously when using `env_logger` all of our cli-tools logged to
stderr, make tracing do the same. Export `tracing::Level` so that we can
use the `tracing::enabled!` macro.
Tested-by: Christian Ebner <c.ebner@proxmox.com> Reviewed-by: Christian Ebner <c.ebner@proxmox.com> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Gabriel Goller [Thu, 29 Aug 2024 13:40:39 +0000 (15:40 +0200)]
add tracing init_cli_logger and deprecate old one
Deprecate the proxmox-router init_cli_logger function used in client
binaries such as `proxmox-backup-client`, `proxmox-backup-manager`,
'pxar', etc... Add a new init_cli_logger function that uses tracing
instead of env_logger. It checks if the task is in a workertask and
prints the message either to stdout or to the tasklog (this is
neccessary for commands in proxmox-backup-manager that call api handlers
that start workerthreads from the client).
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Dominik Csapak [Fri, 9 Aug 2024 08:25:25 +0000 (10:25 +0200)]
router: sort cli properties in usage output
If we don't do this, then properties from a serde flattened struct will
be positioned at the end of the list, rather than properly sorted with
the other properties.
Since the tests also feature non-sorted properties, we have to adapt
them too.
schema: seal ObjectSchemaType and assert Send + Sync
While this is technically a breaking API change since the trait is
public, we don't implement it anywhere and it isn't meant to be
implemented from the outside.
Also, encode that these types are all Send + Sync via a super trait
notation.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
systemd: debcargo: add libsystemd-dev to dependencies
`Build-Depends` and `Depends` in d/control are missing `libsystemd-dev`,
resulting in mk-build-deps not being able to install all dependencies
needed by `make deb`.
warning: unresolved link to `seccfg`
--> proxmox-section-config/src/typed.rs:18:71
|
18 | /// If the [`SectionConfig`] returned by the [`section_config()`][seccfg] method includes the
| ^^^^^^ no item named `seccfg` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
warning: unresolved link to `seccfg`
--> proxmox-section-config/src/typed.rs:22:10
|
22 | /// [seccfg] ApiSectionDataEntry::section_config()
| ^^^^^^ no item named `seccfg` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
warning: doc list item missing indentation
--> proxmox-access-control/src/acl.rs:518:9
|
518 | /// -- user/token is more specific than group at each level
| ^
|
= 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
|
518 | /// -- user/token is more specific than group at each level
| ++
warning: doc list item missing indentation
--> proxmox-access-control/src/acl.rs:519:9
|
519 | /// -- roles lower in the tree are more specific than those higher up along the path
| ^
|
= 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
help: indent this line
|
519 | /// -- roles lower in the tree are more specific than those higher up along the path
| ++
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
apt: cache_api: simplify match with unwrap_or_default
Fixes:
warning: match can be simplified with `.unwrap_or_default()`
--> proxmox-apt/src/cache_api.rs:77:28
|
77 | let mut notified = match cache.notified {
| ____________________________^
78 | | Some(notified) => notified,
79 | | None => std::collections::HashMap::new(),
80 | | };
| |_________^ help: replace it with: `cache.notified.unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
= note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> proxmox-router/src/cli/completion.rs:154:25
|
154 | &completion_functions,
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `completion_functions`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> proxmox-router/src/cli/completion.rs:201:21
|
201 | &completion_functions,
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `completion_functions`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
rrd_map: remove unnecessary use of get().is_some()
Fixes:
warning: unnecessary use of `get(rel_path).is_some()`
--> proxmox-rrd/src/cache/rrd_map.rs:107:21
|
107 | if self.map.get(rel_path).is_some() {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains_key(rel_path)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
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>