Commit 76db61c7 authored by Efthymia Bika's avatar Efthymia Bika

Set gpg-homedir arg when calling duplicity

parent 4536ef7b
...@@ -31,6 +31,11 @@ var BAAS_CACHE_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'cache'); ...@@ -31,6 +31,11 @@ var BAAS_CACHE_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'cache');
var BAAS_ARCHIVE_DIR = path.join(BAAS_CACHE_DIR, 'duplicity'); var BAAS_ARCHIVE_DIR = path.join(BAAS_CACHE_DIR, 'duplicity');
var RESTORE_DEFAULT_DIR = path.join(get_user_home(), "Downloads"); var RESTORE_DEFAULT_DIR = path.join(get_user_home(), "Downloads");
var GPG_DIR = path.join(get_user_home(), '.gnupg');
if(process.platform == "win32") {
GPG_DIR = get_unix_path(GPG_DIR);
}
var running_processes = []; var running_processes = [];
var SHA256 = require("crypto-js/sha256"); var SHA256 = require("crypto-js/sha256");
......
...@@ -227,6 +227,7 @@ function call_duplicity(mode, backup_set, force) { ...@@ -227,6 +227,7 @@ function call_duplicity(mode, backup_set, force) {
} }
args.push("--log-file", log_file); args.push("--log-file", log_file);
args.push("--archive-dir", BAAS_ARCHIVE_DIR); args.push("--archive-dir", BAAS_ARCHIVE_DIR);
args.push("--gpg-homedir", GPG_DIR);
var backup_name = (backup_set) ? var backup_name = (backup_set) ?
hashed_backup_name(backup_set.cloud, backup_set.name) : hashed_backup_name(backup_set.cloud, backup_set.name) :
......
...@@ -158,14 +158,13 @@ function get_contents_by_date(value) { ...@@ -158,14 +158,13 @@ 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 backup_name = hashed_backup_name( var backup_name = hashed_backup_name(
$("#cloud").val(), $("#backup-name").val()); $("#cloud").val(), $("#backup-name").val());
var datapath = path.join(BAAS_CACHE_DIR, 'timeviews', backup_name); var datapath = path.join(BAAS_CACHE_DIR, 'timeviews', backup_name);
var args = ["python", TIMEVIEW_PATH, datapath, var args = ["python", TIMEVIEW_PATH, datapath,
"swift://" + container, cert, archive_dir, "swift://" + container, cert, BAAS_ARCHIVE_DIR,
backup_name, "get", value, time_path]; GPG_DIR, backup_name, "get", value, time_path];
execFile(ENV_CMD, args, {env: make_env()}, show_contents_by_date); execFile(ENV_CMD, args, {env: make_env()}, show_contents_by_date);
} }
......
...@@ -85,6 +85,7 @@ def fetch_timepoint(config, timepoint): ...@@ -85,6 +85,7 @@ def fetch_timepoint(config, timepoint):
args = [duplicity, 'list-current-files', '-t', timepoint, args = [duplicity, 'list-current-files', '-t', timepoint,
'--ssl-cacert-file', config['cacert_file'], '--ssl-cacert-file', config['cacert_file'],
'--archive-dir', config['archive_dir'], '--archive-dir', config['archive_dir'],
'--gpg-homedir', config['gpg_homedir'],
'--name', config['backup_name'], '--name', config['backup_name'],
config['target_url']] config['target_url']]
...@@ -154,36 +155,38 @@ def get_config(): ...@@ -154,36 +155,38 @@ def get_config():
def main(): def main():
from sys import argv, stdin, stdout from sys import argv, stdin, stdout
def help(): def help():
print "Usage: %s <datapath> <target_url> <cacert_file> <archive_dir> <backup_name> [get <absolute_timepoint> <path> | list]" % argv[0] print "Usage: %s <datapath> <target_url> <cacert_file> <archive_dir> <gpg_homedir> <backup_name> [get <absolute_timepoint> <path> | list]" % argv[0]
raise SystemExit(1) raise SystemExit(1)
if len(argv) < 7: if len(argv) < 8:
help() help()
datapath = argv[1] datapath = argv[1]
ensure_datapath(datapath) ensure_datapath(datapath)
target_url = argv[2] target_url = argv[2]
cmd = argv[6] cmd = argv[7]
if cmd not in ['get', 'list']: if cmd not in ['get', 'list']:
help() help()
cacert_file = argv[3] cacert_file = argv[3]
archive_dir = argv[4] archive_dir = argv[4]
backup_name = argv[5] gpg_homedir = argv[5]
backup_name = argv[6]
#config = get_config() #config = get_config()
config = {'datapath': datapath, config = {'datapath': datapath,
'target_url': target_url, 'target_url': target_url,
'cacert_file': cacert_file, 'cacert_file': cacert_file,
'archive_dir': archive_dir, 'archive_dir': archive_dir,
'gpg_homedir': gpg_homedir,
'backup_name': backup_name} 'backup_name': backup_name}
if cmd == 'get': if cmd == 'get':
if len(argv) < 9: if len(argv) < 10:
help() help()
timepoint = argv[7] timepoint = argv[8]
path = unicode(argv[8], encoding='UTF-8') path = unicode(argv[9], encoding='UTF-8')
r = get_timepoint(config, timepoint, path) r = get_timepoint(config, timepoint, path)
print json.dumps(r, indent=2) print json.dumps(r, indent=2)
......
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