Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 1 | #include "config.h" |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 2 | |
| 3 | #include "image_manager.hpp" |
| 4 | |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 5 | #include "version.hpp" |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 6 | #include "watch.hpp" |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 7 | |
| 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> |
| 10 | #include <sys/stat.h> |
| 11 | #include <sys/wait.h> |
| 12 | #include <unistd.h> |
| 13 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 14 | #include <elog-errors.hpp> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 15 | #include <phosphor-logging/elog.hpp> |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 16 | #include <phosphor-logging/lg2.hpp> |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 17 | #include <xyz/openbmc_project/Software/Image/error.hpp> |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 18 | |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 19 | #include <algorithm> |
| 20 | #include <cstring> |
| 21 | #include <filesystem> |
| 22 | #include <string> |
| 23 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 24 | namespace phosphor |
| 25 | { |
| 26 | namespace software |
| 27 | { |
| 28 | namespace manager |
| 29 | { |
| 30 | |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 31 | PHOSPHOR_LOG2_USING; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 32 | using namespace phosphor::logging; |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 33 | using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 34 | namespace Software = phosphor::logging::xyz::openbmc_project::Software; |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 35 | using ManifestFail = Software::Image::ManifestFileFailure; |
| 36 | using UnTarFail = Software::Image::UnTarFailure; |
| 37 | using InternalFail = Software::Image::InternalFailure; |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 38 | using ImageFail = Software::Image::ImageFailure; |
Adriana Kobylak | c98d912 | 2020-05-05 10:36:01 -0500 | [diff] [blame] | 39 | namespace fs = std::filesystem; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 40 | |
| 41 | struct RemovablePath |
| 42 | { |
| 43 | fs::path path; |
| 44 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 45 | RemovablePath(const fs::path& path) : path(path) |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 46 | {} |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 47 | ~RemovablePath() |
| 48 | { |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 49 | if (!path.empty()) |
Adriana Kobylak | 2b2cd9f | 2018-02-12 16:20:13 -0600 | [diff] [blame] | 50 | { |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 51 | std::error_code ec; |
| 52 | fs::remove_all(path, ec); |
Adriana Kobylak | 2b2cd9f | 2018-02-12 16:20:13 -0600 | [diff] [blame] | 53 | } |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 54 | } |
| 55 | }; |
| 56 | |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 57 | namespace // anonymous |
| 58 | { |
| 59 | |
| 60 | std::vector<std::string> getSoftwareObjects(sdbusplus::bus::bus& bus) |
| 61 | { |
| 62 | std::vector<std::string> paths; |
| 63 | auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH, |
| 64 | MAPPER_INTERFACE, "GetSubTreePaths"); |
| 65 | method.append(SOFTWARE_OBJPATH); |
| 66 | method.append(0); // Depth 0 to search all |
| 67 | method.append(std::vector<std::string>({VERSION_BUSNAME})); |
| 68 | auto reply = bus.call(method); |
| 69 | reply.read(paths); |
| 70 | return paths; |
| 71 | } |
| 72 | |
| 73 | } // namespace |
| 74 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 75 | int Manager::processImage(const std::string& tarFilePath) |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 76 | { |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 77 | if (!fs::is_regular_file(tarFilePath)) |
| 78 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 79 | error("Tarball {PATH} does not exist", "PATH", tarFilePath); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 80 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 81 | return -1; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 82 | } |
| 83 | RemovablePath tarPathRemove(tarFilePath); |
| 84 | fs::path tmpDirPath(std::string{IMG_UPLOAD_DIR}); |
| 85 | tmpDirPath /= "imageXXXXXX"; |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 86 | auto tmpDir = tmpDirPath.string(); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 87 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 88 | // Create a tmp dir to extract tarball. |
| 89 | if (!mkdtemp(tmpDir.data())) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 90 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 91 | error("Error ({ERRNO}) occurred during mkdtemp", "ERRNO", errno); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 92 | report<InternalFailure>(InternalFail::FAIL("mkdtemp")); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 93 | return -1; |
| 94 | } |
| 95 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 96 | tmpDirPath = tmpDir; |
| 97 | RemovablePath tmpDirToRemove(tmpDirPath); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 98 | fs::path manifestPath = tmpDirPath; |
| 99 | manifestPath /= MANIFEST_FILE_NAME; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 100 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 101 | // Untar tarball into the tmp dir |
| 102 | auto rc = unTar(tarFilePath, tmpDirPath.string()); |
| 103 | if (rc < 0) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 104 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 105 | error("Error ({RC}) occurred during untar", "RC", rc); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 106 | return -1; |
| 107 | } |
| 108 | |
| 109 | // Verify the manifest file |
| 110 | if (!fs::is_regular_file(manifestPath)) |
| 111 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 112 | error("No manifest file {PATH}", "PATH", tarFilePath); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 113 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 114 | return -1; |
| 115 | } |
| 116 | |
| 117 | // Get version |
| 118 | auto version = Version::getValue(manifestPath.string(), "version"); |
| 119 | if (version.empty()) |
| 120 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 121 | error("Unable to read version from manifest file {PATH}", "PATH", |
| 122 | tarFilePath); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 123 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 124 | return -1; |
| 125 | } |
| 126 | |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 127 | // Get running machine name |
| 128 | std::string currMachine = Version::getBMCMachine(OS_RELEASE_FILE); |
| 129 | if (currMachine.empty()) |
| 130 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 131 | auto path = OS_RELEASE_FILE; |
| 132 | error("Failed to read machine name from osRelease: {PATH}", "PATH", |
| 133 | path); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 134 | report<ImageFailure>(ImageFail::FAIL("Failed to read machine name"), |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 135 | ImageFail::PATH(path)); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 136 | return -1; |
| 137 | } |
| 138 | |
| 139 | // Get machine name for image to be upgraded |
| 140 | std::string machineStr = |
| 141 | Version::getValue(manifestPath.string(), "MachineName"); |
| 142 | if (!machineStr.empty()) |
| 143 | { |
| 144 | if (machineStr != currMachine) |
| 145 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 146 | error( |
| 147 | "BMC upgrade: Machine name doesn't match: {CURRENT_MACHINE} vs {NEW_MACHINE}", |
| 148 | "CURRENT_MACHINE", currMachine, "NEW_MACHINE", machineStr); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 149 | report<ImageFailure>( |
| 150 | ImageFail::FAIL("Machine name does not match"), |
| 151 | ImageFail::PATH(manifestPath.string().c_str())); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 152 | return -1; |
| 153 | } |
| 154 | } |
| 155 | else |
| 156 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 157 | warning("No machine name in Manifest file"); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 158 | report<ImageFailure>( |
| 159 | ImageFail::FAIL("MANIFEST is missing machine name"), |
| 160 | ImageFail::PATH(manifestPath.string().c_str())); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 163 | // Get purpose |
| 164 | auto purposeString = Version::getValue(manifestPath.string(), "purpose"); |
| 165 | if (purposeString.empty()) |
| 166 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 167 | error("Unable to read purpose from manifest file {PATH}", "PATH", |
| 168 | tarFilePath); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 169 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 170 | return -1; |
| 171 | } |
| 172 | |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 173 | auto convertedPurpose = |
| 174 | sdbusplus::message::convert_from_string<Version::VersionPurpose>( |
| 175 | purposeString); |
| 176 | |
| 177 | if (!convertedPurpose) |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 178 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 179 | error( |
| 180 | "Failed to convert manifest purpose ({PURPOSE}) to enum; setting to Unknown.", |
| 181 | "PURPOSE", purposeString); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 182 | } |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 183 | auto purpose = convertedPurpose.value_or(Version::VersionPurpose::Unknown); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 184 | |
Chanh Nguyen | 1fd6ddd | 2021-01-06 11:09:09 +0700 | [diff] [blame] | 185 | // Get ExtendedVersion |
| 186 | std::string extendedVersion = |
| 187 | Version::getValue(manifestPath.string(), "ExtendedVersion"); |
| 188 | |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 189 | // Compute id |
| 190 | auto id = Version::getId(version); |
| 191 | |
| 192 | fs::path imageDirPath = std::string{IMG_UPLOAD_DIR}; |
| 193 | imageDirPath /= id; |
| 194 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 195 | auto objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 196 | |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 197 | // This service only manages the uploaded versions, and there could be |
| 198 | // active versions on D-Bus that is not managed by this service. |
| 199 | // So check D-Bus if there is an existing version. |
| 200 | auto allSoftwareObjs = getSoftwareObjects(bus); |
| 201 | auto it = |
| 202 | std::find(allSoftwareObjs.begin(), allSoftwareObjs.end(), objPath); |
| 203 | if (versions.find(id) == versions.end() && it == allSoftwareObjs.end()) |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 204 | { |
selvaganapathim | 3ea1e87 | 2021-09-09 22:55:30 +0530 | [diff] [blame^] | 205 | // Rename the temp dir to image dir |
| 206 | fs::rename(tmpDirPath, imageDirPath); |
| 207 | // Clear the path, so it does not attemp to remove a non-existing path |
| 208 | tmpDirToRemove.path.clear(); |
| 209 | |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 210 | // Create Version object |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 211 | auto versionPtr = std::make_unique<Version>( |
Chanh Nguyen | 1fd6ddd | 2021-01-06 11:09:09 +0700 | [diff] [blame] | 212 | bus, objPath, version, purpose, extendedVersion, |
| 213 | imageDirPath.string(), |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 214 | std::bind(&Manager::erase, this, std::placeholders::_1)); |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 215 | versionPtr->deleteObject = |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 216 | std::make_unique<phosphor::software::manager::Delete>(bus, objPath, |
| 217 | *versionPtr); |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 218 | versions.insert(std::make_pair(id, std::move(versionPtr))); |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 219 | } |
| 220 | else |
| 221 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 222 | info("Software Object with the same version ({VERSION}) already exists", |
| 223 | "VERSION", id); |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 224 | } |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 225 | return 0; |
| 226 | } |
| 227 | |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 228 | void Manager::erase(std::string entryId) |
| 229 | { |
| 230 | auto it = versions.find(entryId); |
| 231 | if (it == versions.end()) |
| 232 | { |
| 233 | return; |
| 234 | } |
Eddie James | 6d87371 | 2017-09-01 11:29:07 -0500 | [diff] [blame] | 235 | |
| 236 | if (it->second->isFunctional()) |
| 237 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 238 | error( |
| 239 | "Version {VERSION} is currently running on the BMC; unable to remove", |
| 240 | "VERSION", entryId); |
Eddie James | 6d87371 | 2017-09-01 11:29:07 -0500 | [diff] [blame] | 241 | return; |
| 242 | } |
| 243 | |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 244 | // Delete image dir |
| 245 | fs::path imageDirPath = (*(it->second)).path(); |
| 246 | if (fs::exists(imageDirPath)) |
| 247 | { |
| 248 | fs::remove_all(imageDirPath); |
| 249 | } |
| 250 | this->versions.erase(entryId); |
| 251 | } |
| 252 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 253 | int Manager::unTar(const std::string& tarFilePath, |
| 254 | const std::string& extractDirPath) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 255 | { |
| 256 | if (tarFilePath.empty()) |
| 257 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 258 | error("TarFilePath is empty"); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 259 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 260 | return -1; |
| 261 | } |
| 262 | if (extractDirPath.empty()) |
| 263 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 264 | error("ExtractDirPath is empty"); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 265 | report<UnTarFailure>(UnTarFail::PATH(extractDirPath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 266 | return -1; |
| 267 | } |
| 268 | |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 269 | info("Untaring {PATH} to {EXTRACTIONDIR}", "PATH", tarFilePath, |
| 270 | "EXTRACTIONDIR", extractDirPath); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 271 | int status = 0; |
| 272 | pid_t pid = fork(); |
| 273 | |
| 274 | if (pid == 0) |
| 275 | { |
| 276 | // child process |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 277 | execl("/bin/tar", "tar", "-xf", tarFilePath.c_str(), "-C", |
| 278 | extractDirPath.c_str(), (char*)0); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 279 | // execl only returns on fail |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 280 | error("Failed to execute untar on {PATH}", "PATH", tarFilePath); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 281 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 282 | return -1; |
| 283 | } |
| 284 | else if (pid > 0) |
| 285 | { |
| 286 | waitpid(pid, &status, 0); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 287 | if (WEXITSTATUS(status)) |
| 288 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 289 | error("Failed ({STATUS}) to untar file {PATH}", "STATUS", status, |
| 290 | "PATH", tarFilePath); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 291 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
| 292 | return -1; |
| 293 | } |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 294 | } |
| 295 | else |
| 296 | { |
Patrick Williams | c9bb642 | 2021-08-27 06:18:35 -0500 | [diff] [blame] | 297 | error("fork() failed: {ERRNO}", "ERRNO", errno); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 298 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 299 | return -1; |
| 300 | } |
| 301 | |
| 302 | return 0; |
| 303 | } |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 304 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 305 | } // namespace manager |
| 306 | } // namespace software |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 307 | } // namespace phosphor |