Prevent magic-folder join if already joined.

This commit is contained in:
David Stainton 2015-11-05 16:56:31 +01:00 committed by Brian Warner
parent 6b4d3b8c6d
commit aea2cf2890

View File

@ -153,6 +153,9 @@ def join(options):
dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap") dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap")
collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap") collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap")
if os.path.exists(dmd_cap_file) or os.path.exists(collective_readcap_file):
raise usage.UsageError("Cannot join. Already joined.")
fileutil.write(dmd_cap_file, dmd_write_cap) fileutil.write(dmd_cap_file, dmd_write_cap)
fileutil.write(collective_readcap_file, magic_readonly_cap) fileutil.write(collective_readcap_file, magic_readonly_cap)