From 0451c3677dbd6cdac99521e59f90dca16f8739b2 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Wed, 13 Jul 2011 11:18:13 +0200 Subject: fix problems with unreadable files cleaned up debug messages changed pools parameter to env --- src/vsession.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/vsession.cpp') diff --git a/src/vsession.cpp b/src/vsession.cpp index 4d48326..e9059f2 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -110,13 +110,13 @@ bool VSession::isActive() const { if (fromDate.isValid() && fromDate > today) { // fromDate is in the future - if (debugMode) qDebug() << "ERR: fromDate is in the future"; + if (debugMode) qDebug() << "Not active. Reason: fromDate is in the future"; return false; } if (tillDate.isValid() && tillDate < today) { // tillDate is in the past - if (debugMode) qDebug() << "ERR: tillDate is in the past"; + if (debugMode) qDebug() << "Not active. Reason: tillDate is in the past"; return false; } } @@ -125,7 +125,7 @@ bool VSession::isActive() const { QStringList pools = getAttribute("pools").split("\\s*,\\s*"); if (!pools.isEmpty() && !pools.contains(pool)) { // pools does not contain pool - if (debugMode) qDebug() << "ERR: pools does not contain pool"; + if (debugMode) qDebug() << "Not active. Reason: vsession is not part of active env"; return false; } } @@ -362,8 +362,19 @@ QList VSession::readXmlDir(const QString& path) { QDirIterator::FollowSymlinks); while (di.hasNext()) { if (!di.next().endsWith(".xml")) continue; + + if (!di.fileInfo().isReadable()) { + if (debugMode) qDebug() << "skip" << di.fileInfo().absoluteFilePath() << ": xml not readable, incorrect file permissions"; + continue; + } + QList vsessionTmp = readXmlFile(di.fileInfo().absoluteFilePath()); + if (vsessionTmp.isEmpty()) { + if (debugMode) qDebug() << "skip" << di.fileInfo().absoluteFilePath() << ": reading xml failed for some reason"; + continue; + } + if (!vsessionTmp.first()->isValid()) { if (debugMode) qDebug() << "skip" << vsessionTmp.first()->shortDescription() << ": vdi/vmdk missing"; continue; -- cgit v1.2.3-55-g7522