LOG(ERROR) << "Failure occurs";
do {
if ((*it)->undo() != Step::Status::OK) {
- LOG(ERROR) << "Error during undo operation";
+ LOG(ERROR) << "Error during undo operation, but continuing...!";
ret = -2;
}
} while (it-- != itStart);
for (auto& pair : icons_) {
if (!MoveFile(pair.second, pair.first)) {
LOG(ERROR) << "Cannot revert icon from backup: " << pair.first;
- // undo cannot fail, so no break
+ return Status::ERROR;
}
}
LOG(DEBUG) << "Icons reverted from backup";
}
common_installer::Step::Status StepCopyStorageDirectories::undo() {
+ common_installer::Step::Status ret = Status::OK;
if (!MoveAppStorage(context_->pkg_path.get(),
backup_path_,
kDataLocation)) {
- LOG(ERROR) << "Failed to restore private directory for widget in update";
-// return Status::ERROR; // undo cannot fail...
+ LOG(ERROR) << "Failed to restore private directory for package in update";
+ ret = Status::ERROR;
}
if (!MoveAppStorage(context_->pkg_path.get(),
backup_path_,
kSharedLocation)) {
- LOG(ERROR) << "Failed to restore shared directory for widget in update";
-// return Status::ERROR; // undo cannot fail...
+ LOG(ERROR) << "Failed to restore shared directory for package in update";
+ ret = Status::ERROR;
}
- return Status::OK;
+ return ret;
}
} // namespace filesystem
}
Step::Status StepRegisterApplication::undo() {
- UnregisterAppInPkgmgr(context_->xml_path.get(), context_->pkgid.get(),
- context_->uid.get());
+ if (!UnregisterAppInPkgmgr(context_->xml_path.get(), context_->pkgid.get(),
+ context_->uid.get())) {
+ LOG(ERROR) << "Application couldn't be unregistered";
+ return Status::ERROR;
+ }
+
LOG(INFO) << "Successfuly clean database";
return Status::OK;
}
LOG(DEBUG) << "Restoring directory: " << context_->pkg_path.get();
if (!MoveDir(backup_path, context_->pkg_path.get())) {
LOG(ERROR) << "Cannot restore widget files";
- return Status::OK;
+ return Status::ERROR;
}
}
}
Step::Status StepRemoveIcons::undo() {
+ Step::Status ret = Status::OK;
if (!backups_.empty()) {
LOG(DEBUG) << "Restoring icons files...";
for (auto& pair : backups_) {
if (!MoveFile(pair.first, pair.second)) {
LOG(ERROR) << "Failed to restore: " << pair.second;
// We need to try to restore all icons anyway...
+ ret = Status::ERROR;
}
}
}
- return Status::OK;
+ return ret;
}
} // namespace filesystem
} // namespace common_installer
context_->certificate_info.get(),
context_->uid.get())) {
LOG(ERROR) << "Failed to restore the app registration in pkgmgr";
- // Continue to revert...
- return Step::Status::OK;
+ return Step::Status::ERROR;
}
LOG(INFO) << "Successfully restored the app registration in pkgmgr";
// Revert old xml file if exists
bf::path old_dest_xml_path = _getOldDestXmlPath(*dest_xml_path_);
if (bf::exists(old_dest_xml_path)) {
- common_installer::MoveFile(old_dest_xml_path, *dest_xml_path_);
+ if (!common_installer::MoveFile(old_dest_xml_path, *dest_xml_path_)) {
+ LOG(ERROR) << "Cannot revert old xml file: " << old_dest_xml_path;
+ return Status::ERROR;
+ }
}
return Status::OK;
manifest_x* m = context_->manifest_data.get();
uiapplication_x *uiapp = m->uiapplication;
serviceapplication_x *svcapp = m->serviceapplication;
- if (!RemoveSymLink(uiapp, context_)) return Status::ERROR;
- if (!RemoveSymLink(svcapp, context_)) return Status::ERROR;
- return Status::OK;
+ Step::Status ret = Status::OK;
+ if (!RemoveSymLink(uiapp, context_)) {
+ LOG(ERROR) << "Cannot remove Symboliclink for uiapp";
+ ret = Status::ERROR;
+ }
+ if (!RemoveSymLink(svcapp, context_)) {
+ LOG(ERROR) << "Cannot remove Symboliclink for svcapp";
+ ret = Status::ERROR;
+ }
+
+ return ret;
}
} // namespace filesystem