33 |
force = None |
force = None |
34 |
select_opts = [] |
select_opts = [] |
35 |
select_files = [] |
select_files = [] |
36 |
user_mapping_filename, group_mapping_filename = None, None |
user_mapping_filename, group_mapping_filename, preserve_numerical_ids = \ |
37 |
|
None, None, None |
38 |
|
|
39 |
# These are global because they are set while we are trying to figure |
# These are global because they are set while we are trying to figure |
40 |
# whether to restore or to backup |
# whether to restore or to backup |
41 |
restore_root, restore_index, restore_root_set = None, None, 0 |
restore_root, restore_index, restore_root_set = None, None, 0 |
45 |
"""Parse argument list and set global preferences""" |
"""Parse argument list and set global preferences""" |
46 |
global args, action, create_full_path, force, restore_timestr, remote_cmd |
global args, action, create_full_path, force, restore_timestr, remote_cmd |
47 |
global remote_schema, remove_older_than_string |
global remote_schema, remove_older_than_string |
48 |
global user_mapping_filename, group_mapping_filename |
global user_mapping_filename, group_mapping_filename, \ |
49 |
|
preserve_numerical_ids |
50 |
|
|
51 |
def sel_fl(filename): |
def sel_fl(filename): |
52 |
"""Helper function for including/excluding filelists below""" |
"""Helper function for including/excluding filelists below""" |
53 |
try: return open(filename, "r") |
try: return open(filename, "r") |
77 |
"no-compression-regexp=", "no-eas", "no-file-statistics", |
"no-compression-regexp=", "no-eas", "no-file-statistics", |
78 |
"no-hard-links", "null-separator", |
"no-hard-links", "null-separator", |
79 |
"override-chars-to-quote=", "parsable-output", |
"override-chars-to-quote=", "parsable-output", |
80 |
"print-statistics", "remote-cmd=", "remote-schema=", |
"preserve-numerical-ids", "print-statistics", |
81 |
|
"remote-cmd=", "remote-schema=", |
82 |
"remove-older-than=", "restore-as-of=", "restrict=", |
"remove-older-than=", "restore-as-of=", "restrict=", |
83 |
"restrict-read-only=", "restrict-update-only=", "server", |
"restrict-read-only=", "restrict-update-only=", "server", |
84 |
"ssh-no-compression", "terminal-verbosity=", "test-server", |
"ssh-no-compression", "terminal-verbosity=", "test-server", |
161 |
elif opt == "--override-chars-to-quote": |
elif opt == "--override-chars-to-quote": |
162 |
Globals.set('chars_to_quote', arg) |
Globals.set('chars_to_quote', arg) |
163 |
elif opt == "--parsable-output": Globals.set('parsable_output', 1) |
elif opt == "--parsable-output": Globals.set('parsable_output', 1) |
164 |
|
elif opt == "--preserve-numerical-ids": preserve_numerical_ids = 1 |
165 |
elif opt == "--print-statistics": Globals.set('print_statistics', 1) |
elif opt == "--print-statistics": Globals.set('print_statistics', 1) |
166 |
elif opt == "-r" or opt == "--restore-as-of": |
elif opt == "-r" or opt == "--restore-as-of": |
167 |
restore_timestr, action = arg, "restore-as-of" |
restore_timestr, action = arg, "restore-as-of" |
239 |
|
|
240 |
def init_user_group_mapping(destination_conn): |
def init_user_group_mapping(destination_conn): |
241 |
"""Initialize user and group mapping on destination connection""" |
"""Initialize user and group mapping on destination connection""" |
242 |
global user_mapping_filename, group_mapping_filename |
global user_mapping_filename, group_mapping_filename, \ |
243 |
|
preserve_numerical_ids |
244 |
def get_string_from_file(filename): |
def get_string_from_file(filename): |
245 |
if not filename: return None |
if not filename: return None |
246 |
rp = rpath.RPath(Globals.local_connection, filename) |
rp = rpath.RPath(Globals.local_connection, filename) |
249 |
Log.FatalError("Error '%s' reading mapping file '%s'" % |
Log.FatalError("Error '%s' reading mapping file '%s'" % |
250 |
(str(e), filename)) |
(str(e), filename)) |
251 |
user_mapping_string = get_string_from_file(user_mapping_filename) |
user_mapping_string = get_string_from_file(user_mapping_filename) |
252 |
destination_conn.user_group.init_user_mapping(user_mapping_string) |
destination_conn.user_group.init_user_mapping(user_mapping_string, |
253 |
|
preserve_numerical_ids) |
254 |
group_mapping_string = get_string_from_file(group_mapping_filename) |
group_mapping_string = get_string_from_file(group_mapping_filename) |
255 |
destination_conn.user_group.init_group_mapping(group_mapping_string) |
destination_conn.user_group.init_group_mapping(group_mapping_string, |
256 |
|
preserve_numerical_ids) |
257 |
|
|
258 |
def take_action(rps): |
def take_action(rps): |
259 |
"""Do whatever action says""" |
"""Do whatever action says""" |