mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-13 00:52:44 +08:00
Merge branch 'main' into improve/base
This commit is contained in:
@@ -264,7 +264,7 @@ async fn call_make_volume_response(
|
||||
request: MakeVolumeRequest,
|
||||
headers: HeaderMap,
|
||||
) -> Result<Response<MakeVolumeResponse>, Status> {
|
||||
let mut client = node_service_time_out_client_no_auth(&url.to_string())
|
||||
let mut client = node_service_time_out_client_no_auth(url)
|
||||
.await
|
||||
.map_err(|err| Status::unavailable(format!("cannot reach the node service: {err}")))?;
|
||||
let mut rpc_request = Request::new(request);
|
||||
@@ -273,7 +273,7 @@ async fn call_make_volume_response(
|
||||
}
|
||||
|
||||
async fn call_ping_response(url: &str, headers: HeaderMap) -> Result<Response<PingResponse>, Status> {
|
||||
let mut client = node_service_time_out_client_no_auth(&url.to_string())
|
||||
let mut client = node_service_time_out_client_no_auth(url)
|
||||
.await
|
||||
.map_err(|err| Status::unavailable(format!("cannot reach the node service: {err}")))?;
|
||||
let mut rpc_request = Request::new(PingRequest {
|
||||
|
||||
@@ -30,6 +30,10 @@ use std::collections::{BTreeMap, HashMap};
|
||||
use time::{Duration, OffsetDateTime};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
const LOG_COMPONENT_ADMIN: &str = "admin";
|
||||
const LOG_SUBSYSTEM_OIDC: &str = "oidc";
|
||||
const EVENT_ADMIN_OIDC_POLICY: &str = "admin_oidc_policy";
|
||||
|
||||
pub(crate) struct DefaultFederatedSessionBinding;
|
||||
|
||||
// Legacy receivers reject an empty parsed mapping; current receivers ignore it when the virtual-parent marker is present.
|
||||
@@ -339,6 +343,9 @@ impl FederatedSessionBinding for DefaultFederatedSessionBinding {
|
||||
for policy_name in &selected_policy_names {
|
||||
let exists = iam_store.policy_exists(policy_name).await.map_err(|err| {
|
||||
warn!(
|
||||
event = EVENT_ADMIN_OIDC_POLICY,
|
||||
component = LOG_COMPONENT_ADMIN,
|
||||
subsystem = LOG_SUBSYSTEM_OIDC,
|
||||
provider_id = %authorization.provider_id,
|
||||
parent_user = %parent_user,
|
||||
policy = %policy_name,
|
||||
@@ -367,6 +374,9 @@ impl FederatedSessionBinding for DefaultFederatedSessionBinding {
|
||||
.map_err(|rejection| match rejection {
|
||||
OidcPolicyRejection::Unsupported(policy_names) => {
|
||||
warn!(
|
||||
event = EVENT_ADMIN_OIDC_POLICY,
|
||||
component = LOG_COMPONENT_ADMIN,
|
||||
subsystem = LOG_SUBSYSTEM_OIDC,
|
||||
provider_id = %authorization.provider_id,
|
||||
parent_user = %parent_user,
|
||||
unsupported_policies = ?policy_names,
|
||||
@@ -376,6 +386,9 @@ impl FederatedSessionBinding for DefaultFederatedSessionBinding {
|
||||
}
|
||||
OidcPolicyRejection::Unresolved(policy_names) => {
|
||||
debug!(
|
||||
event = EVENT_ADMIN_OIDC_POLICY,
|
||||
component = LOG_COMPONENT_ADMIN,
|
||||
subsystem = LOG_SUBSYSTEM_OIDC,
|
||||
provider_id = %authorization.provider_id,
|
||||
parent_user = %parent_user,
|
||||
unresolved_policies = ?policy_names,
|
||||
@@ -389,6 +402,9 @@ impl FederatedSessionBinding for DefaultFederatedSessionBinding {
|
||||
})?;
|
||||
if !selection.ignored.is_empty() {
|
||||
debug!(
|
||||
event = EVENT_ADMIN_OIDC_POLICY,
|
||||
component = LOG_COMPONENT_ADMIN,
|
||||
subsystem = LOG_SUBSYSTEM_OIDC,
|
||||
provider_id = %authorization.provider_id,
|
||||
parent_user = %parent_user,
|
||||
ignored_group_policies = ?selection.ignored,
|
||||
|
||||
@@ -5935,8 +5935,18 @@ mod tests {
|
||||
*metadata.last_mut().expect("inline data bytes") ^= 1;
|
||||
tokio::fs::write(&meta_path, metadata).await.expect("damage inline payload");
|
||||
} else {
|
||||
let data_path = object_path.join(info.data_dir.expect("sharded object data directory").to_string());
|
||||
tokio::fs::remove_dir_all(data_path).await.expect("remove object data shards");
|
||||
// Discover version data dirs by listing the object directory
|
||||
// (matching delete_object_part_shards) instead of constructing
|
||||
// the path from info.data_dir, whose UUID string form may not
|
||||
// match the on-disk directory name.
|
||||
let mut entries = tokio::fs::read_dir(&object_path).await.expect("read object dir");
|
||||
while let Some(entry) = entries.next_entry().await.expect("read object dir entry") {
|
||||
if entry.file_type().await.expect("entry file type").is_dir() {
|
||||
tokio::fs::remove_dir_all(entry.path())
|
||||
.await
|
||||
.expect("remove object data shards");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let resolved = store
|
||||
|
||||
Reference in New Issue
Block a user