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
91e4ea6e
Commit
91e4ea6e
authored
Jul 27, 2015
by
Leo Koppelkamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Infer target_type from url
parent
1e3e34f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
backup.py
management/backup.py
+9
-7
daemon.py
management/daemon.py
+0
-1
system-backup.html
management/templates/system-backup.html
+2
-2
No files found.
management/backup.py
View file @
91e4ea6e
...
...
@@ -22,8 +22,7 @@ backup_root = os.path.join(load_environment()["STORAGE_ROOT"], 'backup')
# that depends on it is this many days old.
default_config
=
{
"max_age_in_days"
:
3
,
"target"
:
"file://"
+
os
.
path
.
join
(
backup_root
,
'encrypted'
),
"target_type"
:
"file"
"target"
:
"file://"
+
os
.
path
.
join
(
backup_root
,
'encrypted'
)
}
def
backup_status
(
env
):
...
...
@@ -164,12 +163,16 @@ def get_env():
env
=
{
"PASSPHRASE"
:
get_passphrase
()
}
if
config
[
"target_type"
]
==
's3'
:
if
get_target_type
(
config
)
==
's3'
:
env
[
"AWS_ACCESS_KEY_ID"
]
=
config
[
"target_user"
]
env
[
"AWS_SECRET_ACCESS_KEY"
]
=
config
[
"target_pass"
]
return
env
def
get_target_type
(
config
):
protocol
=
config
[
"target"
]
.
split
(
":"
)[
0
]
return
protocol
def
perform_backup
(
full_backup
):
env
=
load_environment
()
...
...
@@ -267,7 +270,7 @@ def perform_backup(full_backup):
# Change ownership of backups to the user-data user, so that the after-bcakup
# script can access them.
if
config
[
"target_type"
]
==
'file'
:
if
get_target_type
(
config
)
==
'file'
:
shell
(
'check_call'
,
[
"/bin/chown"
,
"-R"
,
env
[
"STORAGE_USER"
],
backup_dir
])
# Execute a post-backup script that does the copying to a remote server.
...
...
@@ -304,7 +307,7 @@ def run_duplicity_verification():
],
get_env
())
def
backup_set_custom
(
target
,
target_user
,
target_pass
,
target_type
,
max_age
):
def
backup_set_custom
(
target
,
target_user
,
target_pass
,
max_age
):
config
=
get_backup_config
()
# max_age must be an int
...
...
@@ -314,7 +317,6 @@ def backup_set_custom(target, target_user, target_pass, target_type, max_age):
config
[
"target"
]
=
target
config
[
"target_user"
]
=
target_user
config
[
"target_pass"
]
=
target_pass
config
[
"target_type"
]
=
target_type
config
[
"max_age_in_days"
]
=
max_age
write_backup_config
(
config
)
...
...
management/daemon.py
View file @
91e4ea6e
...
...
@@ -416,7 +416,6 @@ def backup_set_custom():
request
.
form
.
get
(
'target'
,
''
),
request
.
form
.
get
(
'target_user'
,
''
),
request
.
form
.
get
(
'target_pass'
,
''
),
request
.
form
.
get
(
'target_type'
,
''
),
request
.
form
.
get
(
'max_age'
,
''
)
))
...
...
management/templates/system-backup.html
View file @
91e4ea6e
...
...
@@ -142,8 +142,9 @@ function show_custom_backup() {
"
GET
"
,
{
},
function
(
r
)
{
var
target_type
=
r
.
target
.
split
(
'
:
'
)[
0
]
$
(
"
#target
"
).
val
(
r
.
target
);
$
(
"
#target-type
"
).
val
(
r
.
target_type
);
$
(
"
#target-type
"
).
val
(
target_type
);
$
(
"
#target-user
"
).
val
(
r
.
target_user
);
$
(
"
#target-pass
"
).
val
(
r
.
target_pass
);
$
(
"
#max-age
"
).
val
(
r
.
max_age_in_days
);
...
...
@@ -162,7 +163,6 @@ function set_custom_backup() {
"
POST
"
,
{
target
:
target
,
target_type
:
target_type
,
target_user
:
target_user
,
target_pass
:
target_pass
,
max_age
:
max_age
...
...
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