Skip to content

Commit

Permalink
Carry indivual fields in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer committed Sep 25, 2024
1 parent 78bd455 commit cdf5c36
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions crates/stackable-operator/src/builder/pod/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ pub enum Error {

#[snafu(display(
"The volumeMount is clashing with an already existing volumeMount with the same mountPath but a different content. \
The existing volumeMount is {existing_volume_mount:?}, the new one is {new_volume_mount:?}"
The shared mountPath is {mount_path:?}, \
the existing mount's volume name is {existing_volume_name:?}, \
the existing mount's subPath is {existing_sub_path:?}, \
the existing mount's SubPathExpr is {existing_sub_path_expr:?}, \
the new mount's volume name is {new_volume_name:?}, \
the new mount's subPath is {new_sub_path:?}, \
the new mount's SubPathExpr is {new_sub_path_expr:?}"
))]
ClashingVolumeMountMountPath {
existing_volume_mount: Box<VolumeMount>,
new_volume_mount: Box<VolumeMount>,
ClashingMountPath {
mount_path: String,
existing_volume_name: String,
existing_sub_path: Option<String>,
existing_sub_path_expr: Option<String>,
new_volume_name: String,
new_sub_path: Option<String>,
new_sub_path_expr: Option<String>,
},
}

Expand Down Expand Up @@ -219,9 +230,14 @@ impl ContainerBuilder {
if let Some(existing_volume_mount) = self.volume_mounts.get(&volume_mount.mount_path) {
ensure!(
existing_volume_mount == &volume_mount,
ClashingVolumeMountMountPathSnafu {
existing_volume_mount: existing_volume_mount.clone(),
new_volume_mount: volume_mount,
ClashingMountPathSnafu {
mount_path: volume_mount.mount_path,
existing_volume_name: existing_volume_mount.name.clone(),
existing_sub_path: existing_volume_mount.sub_path.clone(),
existing_sub_path_expr: existing_volume_mount.sub_path_expr.clone(),
new_volume_name: volume_mount.name,
new_sub_path: volume_mount.sub_path,
new_sub_path_expr: volume_mount.sub_path_expr,
}
);
} else {
Expand Down

0 comments on commit cdf5c36

Please sign in to comment.