## Description * Replace the CatalogSource approach to install the OperatorHub.io catalog by a more simple & straightforward way to install NMState * Improve logging * Add report summarizing the host network configuration that was applied (which host, bonds, port-channels) * Fix command to find next available port channel id ## Extra info Using the `apply_url` approach to install the NMState operator isn't the best approach: it's harder to maintain and upgrade. But it helps us achieve waht we wanted for now: install the NMState Operator to configure bonds on a host. The preferred approach, installing an operator from the OperatorHub.io catalog, didn't work for now. We had a timeout error with DeadlineExceeded probably caused by an insufficient CPU/Memory allocation to query such a big catalog, even though we tweaked the RAM allocation (we couldn't find a way to do it for CPU). Spent too much time on this so we stopped these efforts for now. It would be good to get back to it when we need to install something else from a custom catalog. Reviewed-on: https://git.nationtech.io/NationTech/harmony/pulls/175
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
use std::sync::Mutex;
|
|
|
|
use harmony::{
|
|
instrumentation::{self, HarmonyEvent},
|
|
modules::application::ApplicationFeatureStatus,
|
|
};
|
|
|
|
use crate::theme;
|
|
|
|
pub fn init() {
|
|
let details: Mutex<Vec<String>> = Mutex::new(vec![]);
|
|
|
|
instrumentation::subscribe("Harmony CLI Reporter", {
|
|
move |event| {
|
|
let mut details = details.lock().unwrap();
|
|
|
|
match event {
|
|
HarmonyEvent::InterpretExecutionFinished {
|
|
execution_id: _,
|
|
topology: _,
|
|
interpret: _,
|
|
score: _,
|
|
outcome: Ok(outcome),
|
|
} => {
|
|
if outcome.status == harmony::interpret::InterpretStatus::SUCCESS {
|
|
details.extend(outcome.details.clone());
|
|
}
|
|
}
|
|
HarmonyEvent::ApplicationFeatureStateChanged {
|
|
topology: _,
|
|
application: _,
|
|
feature: _,
|
|
status:
|
|
ApplicationFeatureStatus::Installed {
|
|
details: feature_details,
|
|
},
|
|
} => {
|
|
details.extend(feature_details.clone());
|
|
}
|
|
HarmonyEvent::HarmonyFinished => {
|
|
if !details.is_empty() {
|
|
println!(
|
|
"\n{} All done! Here's a few info for you:",
|
|
theme::EMOJI_SUMMARY
|
|
);
|
|
for detail in details.iter() {
|
|
println!("- {detail}");
|
|
}
|
|
println!();
|
|
}
|
|
}
|
|
_ => {}
|
|
};
|
|
}
|
|
});
|
|
}
|