Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
baas
Commits
f6069ec0
Commit
f6069ec0
authored
Oct 20, 2015
by
Efthymia Bika
Browse files
Reverse dir arguments to implement restore
parent
cfe6f1d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
backup-list.html
View file @
f6069ec0
...
...
@@ -199,7 +199,7 @@
});
}
function
run_duplicity
(
allow_source_mismatch
)
{
function
run_duplicity
(
allow_source_mismatch
,
restore
)
{
var
container
=
null
;
var
backup_name
=
$
(
"
#backup-name
"
).
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
);
...
...
@@ -215,7 +215,6 @@
allow_arg
=
"
--allow-source-mismatch
"
;
if
(
process
.
platform
==
'
win32
'
)
{
$
(
"
#loader
"
).
show
();
directory
=
directory
.
replace
(
/
\\
/g
,
"
\\\\
"
);
exec
(
CYGWIN_BASH
+
"
-c
\"
/usr/bin/cygpath '
"
+
directory
+
"
'
\"
"
,
function
(
error
,
stdout
,
stderr
)
{
...
...
@@ -239,18 +238,27 @@
var
cmd3
=
"
export PASSPHRASE=
"
+
passphrase
+
"
;
"
;
var
cmd4
=
"
export SWIFT_PREAUTHURL=
"
+
preauth_url
+
"
;
"
;
var
cmd5
=
"
export SWIFT_PREAUTHTOKEN=
"
+
preauth_token
+
"
;
"
;
var
cmd6
=
"
duplicity
"
+
directory
+
"
swift://
"
+
container
+
"
;
"
;
var
dirs
=
directory
+
"
swift://
"
+
container
;
if
(
restore
)
{
dirs
=
"
swift://
"
+
container
+
"
"
+
directory
;
}
var
cmd6
=
"
duplicity
"
+
dirs
+
"
;
"
;
exec
(
CYGWIN_BASH
+
"
-c '
"
+
cmd1
+
cmd2
+
cmd3
+
cmd4
+
cmd5
+
cmd6
+
"
'
"
,
function
(
error
,
stdout
,
stderr
){
$
(
"
#msg
"
).
html
(
stdout
);
if
(
error
)
$
(
"
#msg
"
).
html
(
error
);
$
(
"
#loader
"
).
hide
();
});
});
$
(
"
#loader
"
).
hide
();
}
else
{
set_envs
();
exec
(
"
duplicity
"
+
allow_arg
+
directory
+
"
swift://
"
+
container
,
function
(
error
,
stdout
,
stderr
)
{
var
dirs
=
directory
+
"
swift://
"
+
container
;
if
(
restore
)
{
dirs
=
"
swift://
"
+
container
+
"
"
+
directory
;
}
exec
(
"
duplicity
"
+
allow_arg
+
dirs
,
function
(
error
,
stdout
,
stderr
)
{
if
(
error
)
{
$
(
"
#msg
"
).
addClass
(
"
panel
"
);
var
src_mismatch_error
=
...
...
@@ -262,7 +270,7 @@
msg
+=
"
If this is not a mistake select OK to continue
"
;
if
(
confirm
(
msg
))
{
run_duplicity
(
true
);
run_duplicity
(
true
,
restore
);
}
}
else
{
$
(
"
#msg
"
).
html
(
error
);
...
...
@@ -277,10 +285,10 @@
}
}
function
backup
()
{
function
backup
(
restore
)
{
$
(
"
#loader
"
).
show
();
save_backup_set
();
run_duplicity
(
false
);
run_duplicity
(
false
,
restore
);
}
function
check_fields
()
{
...
...
@@ -301,9 +309,6 @@
});
function
puts
(
error
,
stdout
,
stderr
)
{
console
.
log
(
"
error ====
"
+
error
);
console
.
log
(
"
stdout ===
"
+
stdout
);
console
.
log
(
"
stderr ===
"
+
stderr
);
if
(
error
)
{
$
(
"
#msg
"
).
html
(
error
);
$
(
"
#msg
"
).
addClass
(
"
panel
"
);
...
...
@@ -331,9 +336,6 @@
});
function
puts
(
error
,
stdout
,
stderr
)
{
console
.
log
(
"
error ====
"
+
error
);
console
.
log
(
"
stdout ===
"
+
stdout
);
console
.
log
(
"
stderr ===
"
+
stderr
);
if
(
error
)
{
$
(
"
#msg
"
).
html
(
error
);
$
(
"
#msg
"
).
addClass
(
"
panel
"
);
...
...
@@ -431,7 +433,7 @@
<div
class=
"clearfix"
>
<div
class=
"small-6 columns"
>
<a
id=
"save_button"
class=
"button radius left"
onclick=
"if(check_fields())
restore(
);"
>
onclick=
"if(check_fields())
backup(true
);"
>
<i
class=
"fa fa-cloud-download"
></i>
Restore
</a>
</div>
<div
class=
"small-6 columns"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment