diff --git a/sbin/dm_deploy_cat_web_service.sh b/sbin/dm_deploy_cat_web_service.sh index d2447499191c14e3498c95e819059bd25dd34971..77145a3747b19a33f518863c3303cd9ade5815d3 100755 --- a/sbin/dm_deploy_cat_web_service.sh +++ b/sbin/dm_deploy_cat_web_service.sh @@ -100,11 +100,11 @@ echo "Checking service certificates" if [ ! -f $DM_WEB_SERVICE_CERT_FILE -o ! -f $DM_WEB_SERVICE_KEY_FILE ]; then if [ ! -f $DM_CA_DIR/certs/$DM_WEB_SERVICE_HOST.crt ]; then echo "Attempting to create DM $DM_WEB_SERVICE_DAEMON certificate" - ssh $DM_DS_WEB_SERVICE_HOST "$MY_DIR/dm_create_server_cert.sh $DM_WEB_SERVICE_HOST $DM_WEB_SERVICE_HOST dm@aps.anl.gov" + ssh $DM_DS_WEB_SERVICE_HOST "$DM_DS_INSTALL_DIR/dm/sbin/dm_create_server_cert.sh $DM_WEB_SERVICE_HOST $DM_WEB_SERVICE_HOST dm@aps.anl.gov" fi echo "Copying DM $DM_WEB_SERVICE_DAEMON certificate" - rsync -ar $DM_DS_WEB_SERVICE_HOST:$DM_CA_DIR/certs/$DM_WEB_SERVICE_HOST.crt $DM_WEB_SERVICE_CERT_FILE || exit 1 - rsync -ar $DM_DS_WEB_SERVICE_HOST:$DM_CA_DIR/certs/$DM_WEB_SERVICE_HOST.key $DM_WEB_SERVICE_KEY_FILE || exit 1 + rsync -ar $DM_DS_WEB_SERVICE_HOST:$DM_DS_INSTALL_DIR/etc/CA/certs/$DM_WEB_SERVICE_HOST.crt $DM_WEB_SERVICE_CERT_FILE || exit 1 + rsync -ar $DM_DS_WEB_SERVICE_HOST:$DM_DS_INSTALL_DIR/etc/CA/certs/$DM_WEB_SERVICE_HOST.key $DM_WEB_SERVICE_KEY_FILE || exit 1 else echo "DM service certificate exists" fi diff --git a/src/python/dm/__init__.py b/src/python/dm/__init__.py index 0f79051400fec8637fcd97e5b7930a1b6e33754f..a75d76ee2e3dbd51df28bf9ea06427eb137eb2ba 100644 --- a/src/python/dm/__init__.py +++ b/src/python/dm/__init__.py @@ -1 +1 @@ -__version__ = "0.2 (2015.07.07)" +__version__ = "0.5 (2015.10.08)" diff --git a/src/python/dm/common/service/loginController.py b/src/python/dm/common/service/loginController.py index 3f2707c5ffe7c4efb8a78b55564abb90956fdffd..b43edb35983db078f40b0eef7dc20cadc4e03226 100755 --- a/src/python/dm/common/service/loginController.py +++ b/src/python/dm/common/service/loginController.py @@ -146,7 +146,7 @@ class LoginController(DmController): sessionId = cherrypy.serving.session.__dict__.get(LoginController.ORIGINAL_SESSION_ID_KEY) #logger.debug('Session: %s' % ((cherrypy.session.__dict__))) logger.debug('Session cache length: %s' % (len(sessionCache))) - #logger.debug('Session cache: %s' % (sessionCache)) + logger.debug('Session cache: %s' % (sessionCache)) # Check session. # Try SingleSignOnManager first @@ -159,6 +159,7 @@ class LoginController(DmController): sessionTuple = sessionCache.get(sessionId) if sessionTuple: sessionInfo = sessionTuple[0] + logger.debug('Retrieved session info from cache: %s' % sessionInfo) else: logger.debug('Retrieved session %s from SSO Manager' % sessionId) sessionCache[sessionId] = (sessionInfo, datetime.datetime.now()) @@ -169,19 +170,20 @@ class LoginController(DmController): raise DmHttpError(dmHttpStatus.DM_HTTP_UNAUTHORIZED, 'User Not Authorized', InvalidSession(errorMsg)) username = sessionInfo.get(LoginController.SESSION_USERNAME_KEY) + if not username: + errorMsg = 'Invalid session id: %s (no username supplied).' % sessionId + logger.debug(errorMsg) + raise DmHttpError(dmHttpStatus.DM_HTTP_UNAUTHORIZED, 'User Not Authorized', InvalidSession(errorMsg)) + cherrypy.session[LoginController.SESSION_ROLE_KEY] = sessionInfo[LoginController.SESSION_ROLE_KEY] logger.debug('Session id %s is valid (username: %s)' % (sessionId, username)) - if username: - cherrypy.request.login = username - for condition in conditions: - # A condition is just a callable that returns true or false - if not condition(): - logger.debug('Authorization check %s() failed for username %s' % (condition.func_name, username)) - errorMsg = 'Authorization check %s() failed for user %s.' % (condition.func_name, username) - raise DmHttpError(dmHttpStatus.DM_HTTP_UNAUTHORIZED, 'User Not Authorized', AuthorizationError(errorMsg)) - else: - logger.debug('Username is not supplied') - raise DmHttpError(dmHttpStatus.DM_HTTP_UNAUTHORIZED, 'User Not Authorized', ex) + cherrypy.request.login = username + for condition in conditions: + # A condition is just a callable that returns true or false + if not condition(): + logger.debug('Authorization check %s() failed for username %s' % (condition.func_name, username)) + errorMsg = 'Authorization check %s() failed for user %s.' % (condition.func_name, username) + raise DmHttpError(dmHttpStatus.DM_HTTP_UNAUTHORIZED, 'User Not Authorized', AuthorizationError(errorMsg)) @cherrypy.expose diff --git a/src/python/dm/common/utility/fileUtility.py b/src/python/dm/common/utility/fileUtility.py index 19b80d3940c9bad17be69d123694dbabdbe6336e..6aa499cecf68faa1a893905b57911cec443066da 100755 --- a/src/python/dm/common/utility/fileUtility.py +++ b/src/python/dm/common/utility/fileUtility.py @@ -3,6 +3,7 @@ import os import stat from dm.common.utility.dmSubprocess import DmSubprocess +from dm.common.utility.timeUtility import TimeUtility class FileUtility: @@ -20,9 +21,12 @@ class FileUtility: statResult = os.stat(filePath) fileInfo['filePath'] = filePath fileInfo['fileSize'] = statResult[stat.ST_SIZE] - fileInfo['createTime'] = statResult[stat.ST_CTIME] - fileInfo['accessTime'] = statResult[stat.ST_ATIME] - fileInfo['modifyTime'] = statResult[stat.ST_MTIME] + fileInfo['fileCreationTime'] = statResult[stat.ST_CTIME] + fileInfo['fileCreationTimeStamp'] = TimeUtility.formatLocalTimeStamp(statResult[stat.ST_CTIME]) + fileInfo['fileAccessTime'] = statResult[stat.ST_ATIME] + fileInfo['fileAccessTimeStamp'] = TimeUtility.formatLocalTimeStamp(statResult[stat.ST_ATIME]) + fileInfo['fileModificationTime'] = statResult[stat.ST_MTIME] + fileInfo['fileModificationTimeStamp'] = TimeUtility.formatLocalTimeStamp(statResult[stat.ST_MTIME]) return fileInfo ####################################################################### diff --git a/src/python/dm/daq_web_service/service/impl/dmFileSystemEventHandler.py b/src/python/dm/daq_web_service/service/impl/dmFileSystemEventHandler.py index b5b5289652830c2378f86ccece62b42d069c5cbd..f342ca47cdf93b4a7d135721fabef46a952f3069 100755 --- a/src/python/dm/daq_web_service/service/impl/dmFileSystemEventHandler.py +++ b/src/python/dm/daq_web_service/service/impl/dmFileSystemEventHandler.py @@ -25,6 +25,9 @@ class DmFileSystemEventHandler(FileSystemEventHandler): def on_created(self, event): FileSystemEventHandler.on_created(self, event) self.logger.debug('File system created event: %s' % (event.__dict__)) + if not event.is_directory: + filePath = event.src_path + self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment) def on_moved(self, event): FileSystemEventHandler.on_moved(self, event) diff --git a/src/python/dm/ds_web_service/service/impl/mongoDbFileCatalogPlugin.py b/src/python/dm/ds_web_service/service/impl/mongoDbFileCatalogPlugin.py index 4d37cad16bd7ea29e4d3205ee9e4696cf790a3e9..11ea3be2415ede18990fce7bd167f5f16d362d18 100755 --- a/src/python/dm/ds_web_service/service/impl/mongoDbFileCatalogPlugin.py +++ b/src/python/dm/ds_web_service/service/impl/mongoDbFileCatalogPlugin.py @@ -28,6 +28,9 @@ class MongoDbFileCatalogPlugin(FileProcessor): # Prepare catalogging entry fileInfo2 = {} + for key in ['md5Sum', 'fileSize', 'fileCreationTime', 'fileCreationTimeStamp']: + if fileInfo.has_key(key): + fileInfo2[key] = fileInfo.get(key, '') fileInfo2['fileName'] = os.path.basename(experimentFilePath) fileInfo2['experimentStorageDirectory'] = experimentStorageDirectory fileInfo2['storageHost'] = storageHost