Commit ff4c25c8 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

Fix computing hashed backup name

parent 31fffb8c
...@@ -217,3 +217,8 @@ function kill_processes() { ...@@ -217,3 +217,8 @@ function kill_processes() {
} }
} }
function hashed_backup_name(cloud, name) {
var full_name = cloud + "/" + name;
return SHA256(full_name).toString();
}
...@@ -229,9 +229,8 @@ function call_duplicity(mode, backup_set, force) { ...@@ -229,9 +229,8 @@ function call_duplicity(mode, backup_set, force) {
args.push("--archive-dir", BAAS_ARCHIVE_DIR); args.push("--archive-dir", BAAS_ARCHIVE_DIR);
var backup_name = (backup_set) ? var backup_name = (backup_set) ?
backup_set.cloud + "/" + backup_set.name : hashed_backup_name(backup_set.cloud, backup_set.name) :
$("#res-cloud").val() + "/" + $("#res-backup-name"); hashed_backup_name($("#res-cloud").val(), $("#res-backup-name"));
backup_name = SHA256(backup_name).toString();
args.push("--name", backup_name); args.push("--name", backup_name);
var sel_cloud = (backup_set) ? backup_set.cloud : var sel_cloud = (backup_set) ? backup_set.cloud :
......
...@@ -160,7 +160,8 @@ function get_contents_by_date(value) { ...@@ -160,7 +160,8 @@ function get_contents_by_date(value) {
var cert = (clouds[$("#cloud").val()].cert) ? var cert = (clouds[$("#cloud").val()].cert) ?
clouds[$("#cloud").val()].cert : DEFAULT_CERT; clouds[$("#cloud").val()].cert : DEFAULT_CERT;
var archive_dir = BAAS_ARCHIVE_DIR; var archive_dir = BAAS_ARCHIVE_DIR;
var backup_name = SHA256($("#backup_name").val() + "/" + $("#cloud").val()); var backup_name = hashed_backup_name(
$("#cloud").val(), $("#backup_name").val());
var args = ["python", TIMEVIEW_PATH, datapath, var args = ["python", TIMEVIEW_PATH, datapath,
"swift://" + container, cert, archive_dir, "swift://" + container, cert, archive_dir,
......
...@@ -19,7 +19,6 @@ import os ...@@ -19,7 +19,6 @@ import os
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import json import json
import errno import errno
import hashlib
path_types = {'reg', 'dir', 'sym', 'fifo', 'sock', 'chr', 'blk'} path_types = {'reg', 'dir', 'sym', 'fifo', 'sock', 'chr', 'blk'}
...@@ -171,7 +170,7 @@ def main(): ...@@ -171,7 +170,7 @@ def main():
cacert_file = argv[3] cacert_file = argv[3]
archive_dir = argv[4] archive_dir = argv[4]
backup_name = hashlib.sha256(argv[5]).hexdigest() backup_name = argv[5]
#config = get_config() #config = get_config()
config = {'datapath': datapath, config = {'datapath': datapath,
'target_url': target_url, 'target_url': target_url,
......
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