Skip to content

Commit b7b43b8

Browse files
committed
Revert "Reduce Error enum size by boxing ClashingMountPathDetails"
This reverts commit 8727f9a.
1 parent e8220b9 commit b7b43b8

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,25 @@ pub enum Error {
2828

2929
#[snafu(display(
3030
"The volumeMount is clashing with an already existing volumeMount with the same mountPath but a different content. \
31-
The shared mountPath is {:?}, \
32-
the existing mount's volume name is {:?}, \
33-
the existing mount's subPath is {:?}, \
34-
the existing mount's SubPathExpr is {:?}, \
35-
the new mount's volume name is {:?}, \
36-
the new mount's subPath is {:?}, \
37-
the new mount's SubPathExpr is {:?}",
38-
details.mount_path,
39-
details.existing_volume_name,
40-
details.existing_sub_path,
41-
details.existing_sub_path_expr,
42-
details.new_volume_name,
43-
details.new_sub_path,
44-
details.new_sub_path_expr
31+
The shared mountPath is {mount_path:?}, \
32+
the existing mount's volume name is {existing_volume_name:?}, \
33+
the existing mount's subPath is {existing_sub_path:?}, \
34+
the existing mount's SubPathExpr is {existing_sub_path_expr:?}, \
35+
the new mount's volume name is {new_volume_name:?}, \
36+
the new mount's subPath is {new_sub_path:?}, \
37+
the new mount's SubPathExpr is {new_sub_path_expr:?}"
4538
))]
4639
ClashingMountPath {
47-
/// We need to box the details, so that the [`Error`] enum does not get too big
48-
details: Box<ClashingMountPathDetails>,
40+
mount_path: String,
41+
existing_volume_name: String,
42+
existing_sub_path: Option<String>,
43+
existing_sub_path_expr: Option<String>,
44+
new_volume_name: String,
45+
new_sub_path: Option<String>,
46+
new_sub_path_expr: Option<String>,
4947
},
5048
}
5149

52-
#[derive(Debug)]
53-
pub struct ClashingMountPathDetails {
54-
mount_path: String,
55-
existing_volume_name: String,
56-
existing_sub_path: Option<String>,
57-
existing_sub_path_expr: Option<String>,
58-
new_volume_name: String,
59-
new_sub_path: Option<String>,
60-
new_sub_path_expr: Option<String>,
61-
}
62-
6350
/// A builder to build [`Container`] objects.
6451
///
6552
/// This will automatically create the necessary volumes and mounts for each `ConfigMap` which is added.
@@ -244,15 +231,13 @@ impl ContainerBuilder {
244231
ensure!(
245232
existing_volume_mount == &volume_mount,
246233
ClashingMountPathSnafu {
247-
details: Box::new(ClashingMountPathDetails {
248-
mount_path: volume_mount.mount_path,
249-
existing_volume_name: existing_volume_mount.name.clone(),
250-
existing_sub_path: existing_volume_mount.sub_path.clone(),
251-
existing_sub_path_expr: existing_volume_mount.sub_path_expr.clone(),
252-
new_volume_name: volume_mount.name,
253-
new_sub_path: volume_mount.sub_path,
254-
new_sub_path_expr: volume_mount.sub_path_expr,
255-
}),
234+
mount_path: volume_mount.mount_path,
235+
existing_volume_name: existing_volume_mount.name.clone(),
236+
existing_sub_path: existing_volume_mount.sub_path.clone(),
237+
existing_sub_path_expr: existing_volume_mount.sub_path_expr.clone(),
238+
new_volume_name: volume_mount.name,
239+
new_sub_path: volume_mount.sub_path,
240+
new_sub_path_expr: volume_mount.sub_path_expr,
256241
}
257242
);
258243
} else {

0 commit comments

Comments
 (0)