[pbs-devel] [PATCH proxmox-backup 2/3] fix #3939: set default value in domains endpoint

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Apr 11 10:12:22 CEST 2022


On 23.03.22 14:01, Matthias Heiserer wrote:
> Because the default realm is stored in node.cfg, here we have to add
> it to the returned information.
> 
> Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
> ---
>  src/api2/access/domain.rs | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 

> @@ -24,17 +24,19 @@ use pbs_api_types::BasicRealmInfo;
>  /// Authentication domain/realm index.
>  fn list_domains(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<BasicRealmInfo>, Error> {
>      let mut list = Vec::new();
> +    let default_realm = node::config()?.0.default_realm;

feels not ideal to pull in the node config here, if we really need to add a config
(see my bugzilla reply asking if the requester would be OK with just making the
realm box stateful), then I'd actually add it in the domain config as priority
flag (allow 0 to 100, default 50) which is then used for sorting the realms and
also for auto-selecting the highest priority + name sorted realm.

Same level of complexity in terms of what we need to safe (one new struct member),
but avoids the need to always load+parse an extra config and also more features we
can use it for.

Please note also that we'd like to have feature parity for the stuff that exists
in PVE or PMG too.





More information about the pbs-devel mailing list