Commit 727c59c5 authored by owsla's avatar owsla

Move test for native Windows to eliminate additional remote call


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@928 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 79fb83cd
...@@ -827,7 +827,3 @@ def checkdest_if_necessary(dest_rp): ...@@ -827,7 +827,3 @@ def checkdest_if_necessary(dest_rp):
Log("Previous backup seems to have failed, regressing " Log("Previous backup seems to have failed, regressing "
"destination now.", 2) "destination now.", 2)
dest_rp.conn.regress.Regress(dest_rp) dest_rp.conn.regress.Regress(dest_rp)
def get_os_name():
"""Created as a function so that it can be called remotely."""
return os.name
...@@ -141,7 +141,7 @@ def set_allowed_requests(sec_level): ...@@ -141,7 +141,7 @@ def set_allowed_requests(sec_level):
"log.Log.log_to_file", "os.getuid", "Time.setcurtime_local", "log.Log.log_to_file", "os.getuid", "Time.setcurtime_local",
"rpath.gzip_open_local_read", "rpath.open_local_read", "rpath.gzip_open_local_read", "rpath.open_local_read",
"Hardlink.initialize_dictionaries", "user_group.uid2uname", "Hardlink.initialize_dictionaries", "user_group.uid2uname",
"user_group.gid2gname", "Main.get_os_name"]) "user_group.gid2gname"])
if sec_level == "read-only" or sec_level == "all": if sec_level == "read-only" or sec_level == "all":
l.extend(["fs_abilities.get_readonly_fsa", l.extend(["fs_abilities.get_readonly_fsa",
"restore.MirrorStruct.get_increment_times", "restore.MirrorStruct.get_increment_times",
......
...@@ -519,6 +519,10 @@ def get_readonly_fsa(desc_string, rp): ...@@ -519,6 +519,10 @@ def get_readonly_fsa(desc_string, rp):
the security module. the security module.
""" """
if os.name == 'nt' and (desc_string == 'source' or
desc_string == 'rdiff-backup repository'):
log.Log("Hardlinks disabled by default on Windows", 4)
Globals.set('preserve_hardlinks', 0)
return FSAbilities(desc_string).init_readonly(rp) return FSAbilities(desc_string).init_readonly(rp)
class SetGlobals: class SetGlobals:
...@@ -776,9 +780,6 @@ def backup_set_globals(rpin, force): ...@@ -776,9 +780,6 @@ def backup_set_globals(rpin, force):
""" """
assert Globals.rbdir.conn is Globals.local_connection assert Globals.rbdir.conn is Globals.local_connection
if rpin.conn.Main.get_os_name() == "nt":
log.Log("Hardlinks disabled by default on Windows", 4)
Globals.set('preserve_hardlinks', 0)
src_fsa = rpin.conn.fs_abilities.get_readonly_fsa('source', rpin) src_fsa = rpin.conn.fs_abilities.get_readonly_fsa('source', rpin)
log.Log(str(src_fsa), 4) log.Log(str(src_fsa), 4)
dest_fsa = FSAbilities('destination').init_readwrite(Globals.rbdir) dest_fsa = FSAbilities('destination').init_readwrite(Globals.rbdir)
...@@ -806,9 +807,6 @@ def backup_set_globals(rpin, force): ...@@ -806,9 +807,6 @@ def backup_set_globals(rpin, force):
def restore_set_globals(rpout): def restore_set_globals(rpout):
"""Set fsa related globals for restore session, given in/out rps""" """Set fsa related globals for restore session, given in/out rps"""
assert rpout.conn is Globals.local_connection assert rpout.conn is Globals.local_connection
if rpout.conn.Main.get_os_name() == "nt":
log.Log("Hardlinks disabled by default on Windows", 4)
Globals.set('preserve_hardlinks', 0)
src_fsa = Globals.rbdir.conn.fs_abilities.get_readonly_fsa( src_fsa = Globals.rbdir.conn.fs_abilities.get_readonly_fsa(
'rdiff-backup repository', Globals.rbdir) 'rdiff-backup repository', Globals.rbdir)
log.Log(str(src_fsa), 4) log.Log(str(src_fsa), 4)
......
Markdown is supported
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