KubeOS/0004-fix-kbimg-add-info-log-for-successful-image-creation.patch

53 lines
1.6 KiB
Diff
Raw Normal View History

From 72dd36b4cefee5a85145103771d9352585cc9388 Mon Sep 17 00:00:00 2001
From: Yuhang Wei <weiyuhang3@huawei.com>
Date: Fri, 13 Dec 2024 15:31:09 +0800
Subject: [PATCH 1/2] fix(kbimg): add info log for successful image creation
Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
---
KubeOS-Rust/kbimg/src/main.rs | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/KubeOS-Rust/kbimg/src/main.rs b/KubeOS-Rust/kbimg/src/main.rs
index 43e9d422..0af7ff89 100644
--- a/KubeOS-Rust/kbimg/src/main.rs
+++ b/KubeOS-Rust/kbimg/src/main.rs
@@ -15,7 +15,7 @@ use std::{fs, path::PathBuf, process::exit};
use anyhow::Result;
use clap::Parser;
use env_logger::{Builder, Env, Target};
-use log::{debug, error};
+use log::{debug, error, info};
mod admin_container;
mod commands;
@@ -55,6 +55,7 @@ fn process(info: Box<dyn CreateImage>, mut config: Config, debug: bool) -> Resul
let path = info.generate_scripts(&config)?;
if !debug {
execute_scripts(path)?;
+ info!("Image created successfully");
} else {
debug!("Executed following command to generate KubeOS image: bash {:?}", path);
}
@@ -129,14 +130,9 @@ fn main() {
}
if let Some(i) = info {
- match process(i, data, cli.debug) {
- Ok(_) => {
- println!("Image created successfully");
- },
- Err(e) => {
- error!("Failed to create image: {:?}", e);
- exit(1);
- },
+ if let Err(e) = process(i, data, cli.debug) {
+ error!("Failed to create image: {:?}", e);
+ exit(1);
}
}
exit(0);
--
2.39.5 (Apple Git-154)