pull/sync: correctly query with remote-ns as parent

else (grand)-parents and siblings/cousins of remote-ns are also
included, and mapping the remote-ns prefix fails.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-05-13 11:25:47 +02:00
parent 7a3e777ded
commit 11567dfbad

View File

@ -752,11 +752,16 @@ async fn query_namespaces(
"api2/json/admin/datastore/{}/namespace",
params.source.store()
);
let data = params
.max_depth
.map(|max_depth| json!({ "max-depth": max_depth }));
let mut data = json!({});
if let Some(max_depth) = params.max_depth {
data["max-depth"] = json!(max_depth);
}
let mut result = match client.get(&path, data).await {
if !params.remote_ns.is_root() {
data["parent"] = json!(params.remote_ns);
}
let mut result = match client.get(&path, Some(data)).await {
Ok(res) => res,
Err(err) => match err.downcast_ref::<HttpError>() {
Some(HttpError { code, message }) => match *code {