Commit 0d34cc46 authored by sveseli's avatar sveseli
Browse files

merged fixes from trunk

parents a32ed806 688b85d9
......@@ -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
......
__version__ = "0.2 (2015.07.07)"
__version__ = "0.5 (2015.10.08)"
......@@ -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
......
......@@ -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
#######################################################################
......
......@@ -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)
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment