419 |
def restore_start_log(rpin, target, time): |
def restore_start_log(rpin, target, time): |
420 |
"""Open restore log file, log initial message""" |
"""Open restore log file, log initial message""" |
421 |
try: Log.open_logfile(datadir.append("restore.log")) |
try: Log.open_logfile(datadir.append("restore.log")) |
422 |
except LoggerError, e: Log("Warning, " + str(e), 2) |
except (LoggerError, Security.Violation), e: |
423 |
|
Log("Warning - Unable to open " + str(e), 2) |
424 |
|
|
425 |
# Log following message at file verbosity 3, but term verbosity 4 |
# Log following message at file verbosity 3, but term verbosity 4 |
426 |
log_message = ("Starting restore of %s to %s as it was as of %s." % |
log_message = ("Starting restore of %s to %s as it was as of %s." % |
476 |
global datadir |
global datadir |
477 |
if rpin.isincfile(): relpath = rpin.getincbase().path |
if rpin.isincfile(): relpath = rpin.getincbase().path |
478 |
else: relpath = rpin.path |
else: relpath = rpin.path |
479 |
pathcomps = os.path.join(rpin.conn.os.getcwd(), relpath).split("/") |
if rpin.conn is not Globals.local_connection: |
480 |
assert len(pathcomps) >= 2 # path should be relative to / |
# For security checking consistency, don't get absolute path |
481 |
|
pathcomps = relpath.split('/') |
482 |
|
else: pathcomps = os.path.join(os.getcwd(), relpath).split("/") |
483 |
|
if not pathcomps[0]: min_len_pathcomps = 2 # treat abs paths differently |
484 |
|
else: min_len_pathcomps = 1 |
485 |
|
|
486 |
i = len(pathcomps) |
i = len(pathcomps) |
487 |
while i >= 2: |
while i >= min_len_pathcomps: |
488 |
parent_dir = rpath.RPath(rpin.conn, "/".join(pathcomps[:i])) |
parent_dir = rpath.RPath(rpin.conn, "/".join(pathcomps[:i])) |
489 |
if (parent_dir.isdir() and |
if (parent_dir.isdir() and |
490 |
"rdiff-backup-data" in parent_dir.listdir()): break |
"rdiff-backup-data" in parent_dir.listdir()): break |
618 |
exists, but we cannot find a valid current_mirror marker. You can |
exists, but we cannot find a valid current_mirror marker. You can |
619 |
avoid this message by removing this directory; however any data in it |
avoid this message by removing this directory; however any data in it |
620 |
will be lost. |
will be lost. |
621 |
|
|
622 |
|
Probably this error was caused because the first rdiff-backup session |
623 |
|
into a new directory failed. If this is the case it is safe to delete |
624 |
|
the rdiff_backup_data directory because there is no important |
625 |
|
information in it. |
626 |
|
|
627 |
""" % (Globals.rbdir.path,)) |
""" % (Globals.rbdir.path,)) |
628 |
elif len(curmir_incs) == 1: return 0 |
elif len(curmir_incs) == 1: return 0 |
629 |
else: |
else: |