Commit ef320fa8 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add --delete option to sync directive, to schedule a clean for the

next sync (similar to how it works with the archive directive).
parent d6c7be57
...@@ -1239,6 +1239,7 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False): ...@@ -1239,6 +1239,7 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False):
global DPDBNAME, COLLAB_PW global DPDBNAME, COLLAB_PW
retval = 0 retval = 0
delete_dir = False
logdir = os.path.join(EXPDIR_FMT % { "PID" : PID, "EID" : EID }, "logs") logdir = os.path.join(EXPDIR_FMT % { "PID" : PID, "EID" : EID }, "logs")
...@@ -1248,9 +1249,8 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False): ...@@ -1248,9 +1249,8 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False):
extra_logholes = [] extra_logholes = []
try: try:
opts, node_list = getopt.getopt(args, "nl:r:Ps", [ opts, node_list = getopt.getopt(args, "nl:r:Psd", [
"no-standard", "local=", "remote=", "no-standard", "local=", "remote=", "delete" ])
])
for opt, val in opts: for opt, val in opts:
if opt in ("-n", "--no-standard"): if opt in ("-n", "--no-standard"):
standard_logholes = False standard_logholes = False
...@@ -1271,6 +1271,9 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False): ...@@ -1271,6 +1271,9 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False):
elif opt in ("-s", "--snapshot"): elif opt in ("-s", "--snapshot"):
snapshot_traces = True snapshot_traces = True
pass pass
elif opt in ("-d", "--delete"):
delete_dir = True
pass
pass pass
pass pass
except getopt.error, e: except getopt.error, e:
...@@ -1630,6 +1633,13 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False): ...@@ -1630,6 +1633,13 @@ def do_sync(args, mode="sync", must_be_active=1, as_root=False):
pass pass
pass pass
# Schedule clean
if delete_dir:
os.chdir(logdir)
open(CLEANFILE, 'w')
os.chmod(CLEANFILE, 0664)
pass
return retval return retval
## ##
......
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