conga/luci/utils luci_admin
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-06-29 18:04:32
Modified files:
luci/utils : luci_admin
Log message:
make sure auxiliary DB files have the correct ownership after backup and restore.
luci/utils/luci_admin +14 -5
@@ -875,10 +875,15 @@ try: os.umask(077) except: pass + try: + luci = pwd.getpwnam(LUCI_USER)[2:4] + except: + sys.stderr.write('Cannot find the \"' + LUCI_USER + '\" user.\n') + return -1 + doc = luci_backup(argv[2:]) try: - luci = pwd.getpwnam(LUCI_USER)[2:4] os.chown(LUCI_DB_PATH, luci[0], luci[1]) os.chmod(LUCI_DB_PATH, 0600) except:
@@ -930,10 +935,9 @@ try: os.umask(077) except: pass - ret = True if luci_restore(argv[2:]): print 'The Luci restore failed. Try reinstalling Luci, then restoring again.' - ret = False + return False else: print 'Restore was successful.' restart_message()
@@ -942,11 +946,16 @@ luci = pwd.getpwnam(LUCI_USER)[2:4] os.chown(LUCI_DB_PATH, luci[0], luci[1]) os.chmod(LUCI_DB_PATH, 0600) + for i in [ '.tmp', '.old', '.index', '.lock' ]: + try: + os.chown(LUCI_DB_PATH + i, luci[0], luci[1]) + os.chmod(LUCI_DB_PATH + i, 0600) + except: pass except: - ret = False sys.stderr.write('Unable to change ownership of the Luci database back to user \"' + LUCI_USER + '\"\n') + return False - return ret + return True def luci_help(argv):