Re: [PATCH proxmox v4 2/8] pbs-api-types: move over NodeConfig and related api type from PBS

Hannes Laimer
2026-03-31T11:16:47Z

On 2026-03-27 13:12, Christian Ebner wrote:
> In preparation for refactoring the node config in PBS.
>
> In order to move over the code, the previously used
> proxmox_backup::tools::config::from_property_string()
> helpers are replaced by analogous implementations by inlining the
> serde_json::from_value() calls.
>
> Further, the NodeConfig::validate() was only used by the node's
> save_config() implementation and has therefore been inlined on the
> PBS side to avoid a dependency on openssl crate.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---

[..]

> +impl Iterator for AcmeDomainIter<'_> {
> + type Item = Result<AcmeDomain, Error>;
> +
> + fn next(&mut self) -> Option<Self::Item> {
> + let domain = loop {
> + let index = self.index;
> + self.index += 1;
> +
> + let domain = match index {
> + 0 => self.config.acmedomain0.as_deref(),
> + 1 => self.config.acmedomain1.as_deref(),
> + 2 => self.config.acmedomain2.as_deref(),
> + 3 => self.config.acmedomain3.as_deref(),
> + 4 => self.config.acmedomain4.as_deref(),
> + _ => return None,
> + };
> +
> + if let Some(domain) = domain {
> + break domain;
> + }
> + };
> +
> + Some(
> + AcmeDomain::API_SCHEMA
> + .parse_property_string(domain)
> + .and_then(|domain| Ok(serde_json::from_value(domain)?)),

the `?` is only for error conversion, an explicit
```
- .and_then(|domain| Ok(serde_json::from_value(domain)?)),
+ .and_then(|value| {
+ serde_json::from_value(value).map_err(|err|
err.into())
+ }),
```
might be better. either way, very nit and very minor

> + )
> + }
> +}