add fn get_safe_backup_count
This commit is contained in:
@@ -104,12 +104,7 @@ pub fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem
|
||||
}
|
||||
|
||||
let oss_client = OSSClient::new(endpoint, access_key_id, access_key_secret);
|
||||
let mut backup_count = config_item.backup_count.unwrap_or(10u32) as usize;
|
||||
if backup_count < 1_usize {
|
||||
backup_count = 1_usize;
|
||||
} else if backup_count > 10000_usize {
|
||||
backup_count = 10000_usize;
|
||||
}
|
||||
let backup_count = config_item.get_safe_backup_count();
|
||||
let meta_file_name = &format!("{}/ossbackupd_meta_{}_{}.json", &oss_backupd_config.get_prefix(), &oss_backupd_config.get_host(), &config_item.get_file_name());
|
||||
let new_file = format!("{}/{}", path, config_item.make_oss_key(&oss_backupd_config, "gpg"));
|
||||
|
||||
@@ -171,7 +166,7 @@ pub fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem
|
||||
if options.verbose {
|
||||
print_message(MessageType::DEBUG, &format!("Upload file: {}", temp_pgp_file));
|
||||
}
|
||||
if let Err(e) = oss_client.put_file(bucket, &new_file, oss_util::DEFAULT_URL_VALID_SECS, file_temp_pgp_file) {
|
||||
if let Err(e) = oss_client.put_file(bucket, &new_file, oss_util::DEFAULT_URL_VALID_IN_SECS, file_temp_pgp_file) {
|
||||
print_message(MessageType::ERROR, &format!("Error in encrypt file: {}, at item index: {}", e, item_index));
|
||||
remove_temp_files();
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user