Skip to content
Snippets Groups Projects
Commit f56c014b authored by sveseli's avatar sveseli
Browse files

merge from 0.14

parents 45aeb978 3c2670bd
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
#
# Script used for syncing APS user accounts
# Usage:
#
# $0
#
CURRENT_DIR=`pwd`
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
cd $CURRENT_DIR
DM_ROOT_DIR=$MY_DIR/..
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
DM_CONFIG_FILE=$DM_ROOT_DIR/../etc/dm.aps-user-update-utilities.conf
# Simply run update command after sourcing setup file
dm-update-users-from-aps-db --config-file=$DM_CONFIG_FILE --quiet
...@@ -109,6 +109,7 @@ fi ...@@ -109,6 +109,7 @@ fi
oracleDir=$DM_SUPPORT_DIR/opt/oracle-client/$DM_HOST_ARCH oracleDir=$DM_SUPPORT_DIR/opt/oracle-client/$DM_HOST_ARCH
if [ -d $oracleDir ]; then if [ -d $oracleDir ]; then
LD_LIBRARY_PATH=$oracleDir:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$oracleDir:$LD_LIBRARY_PATH
PATH=$oracleDir:$PATH
fi fi
# Get back to where we were before invoking the setup script # Get back to where we were before invoking the setup script
......
__version__ = "0.13 (2016.05.27)" __version__ = "0.14 (2016.10.13)"
...@@ -150,6 +150,10 @@ Description: ...@@ -150,6 +150,10 @@ Description:
# datetime cannot handle time zone at the moment # datetime cannot handle time zone at the moment
timeZonePos = dmLastUpdate.rfind('-') timeZonePos = dmLastUpdate.rfind('-')
dmLastUpdate = dmLastUpdate[0:timeZonePos] dmLastUpdate = dmLastUpdate[0:timeZonePos]
# remove microseconds from the timestamp
secondPos = dmLastUpdate.rfind('.')
if secondPos > 0:
dmLastUpdate = dmLastUpdate[0:secondPos]
dmLastUpdate = datetime.datetime.strptime(dmLastUpdate, '%Y-%m-%d %H:%M:%S') dmLastUpdate = datetime.datetime.strptime(dmLastUpdate, '%Y-%m-%d %H:%M:%S')
if not dmLastUpdate or dmLastUpdate < apsLastChangeDate: if not dmLastUpdate or dmLastUpdate < apsLastChangeDate:
# User needs update # User needs update
......
...@@ -87,7 +87,7 @@ class ApsUserDbManager: ...@@ -87,7 +87,7 @@ class ApsUserDbManager:
self.logger.debug('Mapping DB tables') self.logger.debug('Mapping DB tables')
for (dbTableName, (dbEntityClass, dbRelationDict)) in apsUserDbEntityMap.APS_USER_DB_ENTITY_MAP.items(): for (dbTableName, (dbEntityClass, dbRelationDict)) in apsUserDbEntityMap.APS_USER_DB_ENTITY_MAP.items():
self.mapTable(dbEntityClass, dbTableName, dbRelationDict) self.mapTable(dbEntityClass, dbTableName, dbRelationDict)
self.logger.debug('Initialized SQLalchemy engines') self.logger.debug('Initialized SQLalchemy APS User DB engine')
finally: finally:
ApsUserDbManager.__lock.release() ApsUserDbManager.__lock.release()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment