Skip to content

Commit d469145

Browse files
committed
jobs: change failed job apply output
1 parent 1193095 commit d469145

File tree

1 file changed

+4
-9
lines changed
  • rust/stackable-cockpit/src/utils/k8s

1 file changed

+4
-9
lines changed

rust/stackable-cockpit/src/utils/k8s/client.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use snafu::{OptionExt, ResultExt, Snafu};
1515
use stackable_operator::{commons::listener::Listener, kvp::Labels};
1616
use tokio::sync::RwLock;
1717
use tracing::{Span, info, instrument};
18-
use tracing_indicatif::{indicatif_println, span_ext::IndicatifSpanExt as _};
18+
use tracing_indicatif::{indicatif_eprintln, indicatif_println, span_ext::IndicatifSpanExt as _};
1919

2020
#[cfg(doc)]
2121
use crate::utils::k8s::ListParamsExt;
@@ -114,7 +114,6 @@ impl Client {
114114

115115
// TODO (Techassi): Impl IntoIterator for Labels
116116
let labels: BTreeMap<String, String> = labels.into();
117-
let mut failed_manifests = Vec::new();
118117

119118
for manifest in serde_yaml::Deserializer::from_str(manifests) {
120119
let mut object = DynamicObject::deserialize(manifest).context(DeserializeYamlSnafu)?;
@@ -165,11 +164,11 @@ impl Client {
165164
// If re-applying a Job fails due to immutability, print out the failed manifests instead of erroring out,
166165
// so the user can decide if the existing Job needs a deletion and recreation
167166
if resource.kind == *"Job" && e.to_string().contains("field is immutable") {
168-
failed_manifests.push(format!(
169-
"{kind} {object_name}",
167+
indicatif_eprintln!(
168+
"Deploying {kind}/{object_name} manifest failed due to immutability",
170169
kind = resource.kind,
171170
object_name = object.name_any().clone()
172-
));
171+
);
173172
object
174173
} else {
175174
indicatif_println!(
@@ -191,10 +190,6 @@ impl Client {
191190
}
192191
}
193192

194-
if !failed_manifests.is_empty() {
195-
indicatif_println!("Failed manifests due to immutability: {failed_manifests:?}");
196-
}
197-
198193
Ok(())
199194
}
200195

0 commit comments

Comments
 (0)