Fix error logging
- The logging interfaces don't support std::string, so need to pass
c-strings to the metadata fields, or the pointer address will be
the one added to the log.
- Log the name of the file uploaded to the BMC instead of the
manifest path when there is a manifest error. The manifest path
is always /tmp/imgXXXX/MANIFEST which doesn't help debug.
- Check the status of the child process after waitpid returns. The
execl call returns when there was an error executing execl, not
if the command executed failed. This will catch when tar returns
a non-0 return code.
Change-Id: Ia4bd2666fc6beec28dee7e821d959a336800d282
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/download_manager.cpp b/download_manager.cpp
index b89ac22..1f31d32 100644
--- a/download_manager.cpp
+++ b/download_manager.cpp
@@ -52,8 +52,8 @@
}
log<level::INFO>("Downloading via TFTP",
- entry("FILENAME=%s", fileName),
- entry("SERVERADDRESS=%s", serverAddress));
+ entry("FILENAME=%s", fileName.c_str()),
+ entry("SERVERADDRESS=%s", serverAddress.c_str()));
// Check if IMAGE DIR exists
fs::path imgDirPath(IMG_UPLOAD_DIR);