Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
96b3a298
Commit
96b3a298
authored
Nov 12, 2016
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsync backup broke other things
parent
abb6a1a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
backup.py
management/backup.py
+8
-6
system-backup.html
management/templates/system-backup.html
+4
-4
No files found.
management/backup.py
View file @
96b3a298
...
@@ -13,6 +13,11 @@ import rtyaml
...
@@ -13,6 +13,11 @@ import rtyaml
from
utils
import
exclusive_process
,
load_environment
,
shell
,
wait_for_service
,
fix_boto
from
utils
import
exclusive_process
,
load_environment
,
shell
,
wait_for_service
,
fix_boto
rsync_ssh_options
=
[
"--ssh-options='-i /root/.ssh/id_rsa_miab'"
,
"--rsync-options=-e
\"
/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p 22 -i /root/.ssh/id_rsa_miab
\"
"
,
]
def
backup_status
(
env
):
def
backup_status
(
env
):
# Root folder
# Root folder
backup_root
=
os
.
path
.
join
(
env
[
"STORAGE_ROOT"
],
'backup'
)
backup_root
=
os
.
path
.
join
(
env
[
"STORAGE_ROOT"
],
'backup'
)
...
@@ -30,11 +35,6 @@ def backup_status(env):
...
@@ -30,11 +35,6 @@ def backup_status(env):
backups
=
{
}
backups
=
{
}
backup_cache_dir
=
os
.
path
.
join
(
backup_root
,
'cache'
)
backup_cache_dir
=
os
.
path
.
join
(
backup_root
,
'cache'
)
rsync_ssh_options
=
[
"--ssh-options='-i /root/.ssh/id_rsa_miab'"
,
"--rsync-options=-e
\"
/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p 22 -i /root/.ssh/id_rsa_miab
\"
"
,
]
def
reldate
(
date
,
ref
,
clip
):
def
reldate
(
date
,
ref
,
clip
):
if
ref
<
date
:
return
clip
if
ref
<
date
:
return
clip
rd
=
dateutil
.
relativedelta
.
relativedelta
(
ref
,
date
)
rd
=
dateutil
.
relativedelta
.
relativedelta
(
ref
,
date
)
...
@@ -410,10 +410,12 @@ def list_target_files(config):
...
@@ -410,10 +410,12 @@ def list_target_files(config):
code
,
listing
=
shell
(
'check_output'
,
rsync_command
,
trap
=
True
)
code
,
listing
=
shell
(
'check_output'
,
rsync_command
,
trap
=
True
)
if
code
==
0
:
if
code
==
0
:
ret
=
[]
for
l
in
listing
.
split
(
'
\n
'
):
for
l
in
listing
.
split
(
'
\n
'
):
match
=
rsync_fn_size_re
.
match
(
l
)
match
=
rsync_fn_size_re
.
match
(
l
)
if
match
:
if
match
:
yield
(
match
.
groups
()[
1
],
int
(
match
.
groups
()[
0
]
.
replace
(
','
,
''
)))
ret
.
append
(
(
match
.
groups
()[
1
],
int
(
match
.
groups
()[
0
]
.
replace
(
','
,
''
)))
)
return
ret
else
:
else
:
raise
ValueError
(
"Connection to rsync host failed"
)
raise
ValueError
(
"Connection to rsync host failed"
)
...
...
management/templates/system-backup.html
View file @
96b3a298
...
@@ -225,10 +225,10 @@ function show_custom_backup() {
...
@@ -225,10 +225,10 @@ function show_custom_backup() {
}
else
if
(
r
.
target
.
substring
(
0
,
8
)
==
"
rsync://
"
)
{
}
else
if
(
r
.
target
.
substring
(
0
,
8
)
==
"
rsync://
"
)
{
$
(
"
#backup-target-type
"
).
val
(
"
rsync
"
);
$
(
"
#backup-target-type
"
).
val
(
"
rsync
"
);
var
path
=
r
.
target
.
substring
(
8
).
split
(
'
//
'
);
var
path
=
r
.
target
.
substring
(
8
).
split
(
'
//
'
);
var
[
user
,
host
]
=
path
.
shift
().
split
(
'
@
'
);
var
host_parts
=
path
.
shift
().
split
(
'
@
'
);
$
(
"
#backup-target-rsync-user
"
).
val
(
user
);
$
(
"
#backup-target-rsync-user
"
).
val
(
host_parts
[
0
]
);
$
(
"
#backup-target-rsync-host
"
).
val
(
host
);
$
(
"
#backup-target-rsync-host
"
).
val
(
host
_parts
[
1
]
);
$
(
"
#backup-target-rsync-path
"
).
val
(
'
/
'
+
path
);
$
(
"
#backup-target-rsync-path
"
).
val
(
'
/
'
+
path
[
0
]
);
}
else
if
(
r
.
target
.
substring
(
0
,
5
)
==
"
s3://
"
)
{
}
else
if
(
r
.
target
.
substring
(
0
,
5
)
==
"
s3://
"
)
{
$
(
"
#backup-target-type
"
).
val
(
"
s3
"
);
$
(
"
#backup-target-type
"
).
val
(
"
s3
"
);
var
hostpath
=
r
.
target
.
substring
(
5
).
split
(
'
/
'
);
var
hostpath
=
r
.
target
.
substring
(
5
).
split
(
'
/
'
);
...
...
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