CLOUDSTACK-5900: Failed to delete template/ISO that failed to download.

(cherry picked from commit 8024f2cc70)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
Sanjay Tripathi 2014-01-30 13:12:59 +05:30 committed by Animesh Chaturvedi
parent 16dbb20b5d
commit a5f73b7285
1 changed files with 5 additions and 4 deletions

View File

@ -1740,11 +1740,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
parent += File.separator;
}
String absoluteTemplatePath = parent + relativeTemplatePath;
File tmpltParent;
if(absoluteTemplatePath.endsWith(String.valueOf(obj.getId()))) {
tmpltParent = new File(absoluteTemplatePath);
File tmpltPath = new File(absoluteTemplatePath);
File tmpltParent = null;
if(tmpltPath.exists() && tmpltPath.isDirectory()) {
tmpltParent = tmpltPath;
} else {
tmpltParent = new File(absoluteTemplatePath).getParentFile();
tmpltParent = tmpltPath.getParentFile();
}
String details = null;
if (!tmpltParent.exists()) {