CS-14555: Calculated checksum before unzip

Otherwise checksum would be overrided by wrong value.
This commit is contained in:
Sheng Yang 2012-04-23 19:00:46 -07:00
parent 5021274232
commit 1ced2ed424
1 changed files with 7 additions and 3 deletions

View File

@ -334,6 +334,13 @@ public class DownloadManagerImpl implements DownloadManager {
_storage.mkdirs(resourcePath);
dnld.setTmpltPath(finalResourcePath);
File originalTemplate = new File(td.getDownloadLocalPath());
String checkSum = computeCheckSum(originalTemplate);
if (checkSum == null) {
s_logger.warn("Something wrong happened when try to calculate the checksum of downloaded template!");
}
dnld.setCheckSum(checkSum);
int imgSizeGigs = (int) Math.ceil(_storage.getSize(td.getDownloadLocalPath()) * 1.0d / (1024 * 1024 * 1024));
imgSizeGigs++; // add one just in case
long timeout = imgSizeGigs * installTimeoutPerGig;
@ -417,9 +424,6 @@ public class DownloadManagerImpl implements DownloadManager {
}
}
String checkSum = computeCheckSum(downloadedTemplate);
dnld.setCheckSum(checkSum);
if (!loc.save()) {
s_logger.warn("Cleaning up because we're unable to save the formats");
loc.purge();