bug 10751: don't remove already removed templates during the account cleanup

status 10751: resolved fixed
This commit is contained in:
alena 2011-09-02 16:06:55 -07:00
parent b93318cb73
commit 3c0396bb20
1 changed files with 7 additions and 5 deletions

View File

@ -1069,11 +1069,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
List<VMTemplateVO> userTemplates = _templateDao.listByAccountId(accountId);
boolean allTemplatesDeleted = true;
for (VMTemplateVO template : userTemplates) {
try {
allTemplatesDeleted = _tmpltMgr.delete(callerUserId, template.getId(), null);
} catch (Exception e) {
s_logger.warn("Failed to delete template while removing account: " + template.getName() + " due to: ", e);
allTemplatesDeleted = false;
if (template.getRemoved() == null) {
try {
allTemplatesDeleted = _tmpltMgr.delete(callerUserId, template.getId(), null);
} catch (Exception e) {
s_logger.warn("Failed to delete template while removing account: " + template.getName() + " due to: ", e);
allTemplatesDeleted = false;
}
}
}