"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Tardis/Sonic.py" between
Tardis-1.1.5.tar.gz and Tardis-1.2.1.tar.gz

About: Tardis is a system for making encrypted, incremental backups of filesystems.

Sonic.py  (Tardis-1.1.5):Sonic.py  (Tardis-1.2.1)
skipping to change at line 99 skipping to change at line 99
cache = CacheDir.CacheDir(basedir, 2, 2, create=new) cache = CacheDir.CacheDir(basedir, 2, 2, create=new)
schema = args.schema if new else None schema = args.schema if new else None
tardisdb = TardisDB.TardisDB(dbfile, backup=False, initialize=schema, al low_upgrade=allowUpgrade) tardisdb = TardisDB.TardisDB(dbfile, backup=False, initialize=schema, al low_upgrade=allowUpgrade)
if tardisdb.needsAuthentication(): if tardisdb.needsAuthentication():
if password is None: if password is None:
password = Util.getPassword(args.password, args.passwordfile, args.p asswordprog, prompt="Password for %s: " % (args.client), allowNone=False, confir m=False) password = Util.getPassword(args.password, args.passwordfile, args.p asswordprog, prompt="Password for %s: " % (args.client), allowNone=False, confir m=False)
Util.authenticate(tardisdb, args.client, password) Util.authenticate(tardisdb, args.client, password)
scheme = tardisdb.getCryptoScheme() scheme = tardisdb.getCryptoScheme()
logger.info("Using crypto scheme %d", scheme)
crypt = TardisCrypto.getCrypto(scheme, password, args.client) crypt = TardisCrypto.getCrypto(scheme, password, args.client)
logger.info("Using crypto scheme %s", TardisCrypto.getCryptoNames(int(sc heme)))
else: else:
crypt = TardisCrypto.getCrypto(0, None, None) crypt = TardisCrypto.getCrypto(0, None, None)
return (tardisdb, cache, crypt) return (tardisdb, cache, crypt)
def createClient(password): def createClient(password):
try: try:
(db, _, crypt) = getDB(None, True, allowRemote=False) (db, _, crypt) = getDB(None, True, allowRemote=False)
if password: if password:
setPassword(password) setPassword(password)
skipping to change at line 277 skipping to change at line 277
sets = sets[-(args.number):] sets = sets[-(args.number):]
for bset in sets: for bset in sets:
t = time.strftime("%d %b, %Y %I:%M:%S %p", time.localtime(float(bset ['starttime']))) t = time.strftime("%d %b, %Y %I:%M:%S %p", time.localtime(float(bset ['starttime'])))
if bset['endtime'] is not None: if bset['endtime'] is not None:
duration = str(datetime.timedelta(seconds = (int(float(bset['end time']) - float(bset['starttime']))))) duration = str(datetime.timedelta(seconds = (int(float(bset['end time']) - float(bset['starttime'])))))
else: else:
duration = '' duration = ''
completed = 'Comp' if bset['completed'] else 'Incomp' completed = 'Comp' if bset['completed'] else 'Incomp'
full = 'Full' if bset['full'] else 'Delta' full = 'Full' if bset['full'] else 'Delta'
isCurrent = current if bset['backupset'] == last['backupset'] else ' if bset['backupset'] == last['backupset']:
' status = current
elif bset['errormsg']:
status = bset['errormsg']
else:
status = ''
#isCurrent = current if bset['backupset'] == last['backupset'] else
''
size = Util.fmtSize(bset['bytesreceived'], formats=['', 'KB', 'MB', 'GB', 'TB']) size = Util.fmtSize(bset['bytesreceived'], formats=['', 'KB', 'MB', 'GB', 'TB'])
print("%-30s %-4d %-6s %3d %-5s %-24s %-7s %6s %5s %8s %s" % (bs et['name'], bset['backupset'], completed, bset['priority'], full, t, duration, b set['filesfull'], bset['filesdelta'], size, isCurrent)) print("%-30s %-4d %-6s %3d %-5s %-24s %-7s %6s %5s %8s %s" % (bs et['name'], bset['backupset'], completed, bset['priority'], full, t, duration, b set['filesfull'], bset['filesdelta'], size, status))
if args.longinfo: if args.longinfo:
commandLine = getCommandLine(db, bset['commandline']) commandLine = getCommandLine(db, bset['commandline'])
if commandLine: if commandLine:
print(" Command Line: %s" % (commandLine.decode('utf-8')) ) print(" Command Line: %s" % (commandLine.decode('utf-8')) )
print() print()
except TardisDB.AuthenticationException as e: except TardisDB.AuthenticationException as e:
logger.error("Authentication failed. Bad password") logger.error("Authentication failed. Bad password")
return 1 return 1
except Exception as e: except Exception as e:
logger.error(e) logger.error(e)
skipping to change at line 478 skipping to change at line 484
sys.exit(1) sys.exit(1)
bsets.append(bset) bsets.append(bset)
names = [b['name'] for b in bsets] names = [b['name'] for b in bsets]
print("Sets to be deleted: %s" % (names)) print("Sets to be deleted: %s" % (names))
if confirm(): if confirm():
filesDeleted = 0 filesDeleted = 0
for bset in bsets: for bset in bsets:
filesDeleted = filesDeleted + db.deleteBackupSet(bset['backupset']) filesDeleted = filesDeleted + db.deleteBackupSet(bset['backupset'])
print("Deleted %d files" % (filesDeleted)) print("Deleted %d files" % (filesDeleted))
removeOrphans(db, cache) if args.purge:
removeOrphans(db, cache)
def removeOrphans(db, cache): def removeOrphans(db, cache):
if hasattr(cache, 'removeOrphans'): if hasattr(cache, 'removeOrphans'):
r = cache.removeOrphans() r = cache.removeOrphans()
logger.debug("Remove Orphans: %s %s", type(r), r) logger.debug("Remove Orphans: %s %s", type(r), r)
count = r['count'] count = r['count']
size = r['size'] size = r['size']
rounds = r['rounds'] rounds = r['rounds']
else: else:
count, size, rounds = Util.removeOrphans(db, cache) count, size, rounds = Util.removeOrphans(db, cache)
skipping to change at line 545 skipping to change at line 552
purgeParser = argparse.ArgumentParser(add_help=False) purgeParser = argparse.ArgumentParser(add_help=False)
purgeParser.add_argument('--priority', dest='priority', default=0, t ype=int, help='Maximum priority backupset to purge') purgeParser.add_argument('--priority', dest='priority', default=0, t ype=int, help='Maximum priority backupset to purge')
purgeParser.add_argument('--incomplete', dest='incomplete', default=Fals e, action='store_true', help='Purge only incomplete backup sets') purgeParser.add_argument('--incomplete', dest='incomplete', default=Fals e, action='store_true', help='Purge only incomplete backup sets')
bsetgroup = purgeParser.add_mutually_exclusive_group() bsetgroup = purgeParser.add_mutually_exclusive_group()
bsetgroup.add_argument("--date", "-d", dest='date', default=None, help="Purge sets before this date") bsetgroup.add_argument("--date", "-d", dest='date', default=None, help="Purge sets before this date")
bsetgroup.add_argument("--backup", "-b", dest='backup', default=None, help="Purge sets before this set") bsetgroup.add_argument("--backup", "-b", dest='backup', default=None, help="Purge sets before this set")
deleteParser = argparse.ArgumentParser(add_help=False) deleteParser = argparse.ArgumentParser(add_help=False)
#deleteParser.add_argument("--backup", "-b", dest='backup', default=Non e, help="Purge sets before this set") #deleteParser.add_argument("--backup", "-b", dest='backup', default=Non e, help="Purge sets before this set")
deleteParser.add_argument("--purge", "-p", dest='purge', default=True, actio n=Util.StoreBoolean, help="Delete files in the backupset")
deleteParser.add_argument("backups", nargs="*", default=None, help="Backup s ets to delete") deleteParser.add_argument("backups", nargs="*", default=None, help="Backup s ets to delete")
cnfParser = argparse.ArgumentParser(add_help=False) cnfParser = argparse.ArgumentParser(add_help=False)
cnfParser.add_argument('--confirm', dest='confirm', action=Util.Sto reBoolean, default=True, help='Confirm deletes and purges') cnfParser.add_argument('--confirm', dest='confirm', action=Util.Sto reBoolean, default=True, help='Confirm deletes and purges')
keyParser = argparse.ArgumentParser(add_help=False) keyParser = argparse.ArgumentParser(add_help=False)
keyGroup = keyParser.add_mutually_exclusive_group(required=True) keyGroup = keyParser.add_mutually_exclusive_group(required=True)
keyGroup.add_argument('--extract', dest='extract', default=False, a ction='store_true', help='Extract keys from database') keyGroup.add_argument('--extract', dest='extract', default=False, a ction='store_true', help='Extract keys from database')
keyGroup.add_argument('--insert', dest='insert', default=False, ac tion='store_true', help='Insert keys from database') keyGroup.add_argument('--insert', dest='insert', default=False, ac tion='store_true', help='Insert keys from database')
keyParser.add_argument('--delete', dest='deleteKeys', default=False , action=Util.StoreBoolean, help='Delete keys from server or database') keyParser.add_argument('--delete', dest='deleteKeys', default=False , action=Util.StoreBoolean, help='Delete keys from server or database')
 End of changes. 6 change blocks. 
5 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)