Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rwm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radoslav Bodó
rwm
Commits
2acfbf24
Commit
2acfbf24
authored
11 months ago
by
Radoslav Bodó
Browse files
Options
Downloads
Patches
Plain Diff
rwm: add tags to backup config
parent
683f01f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#7738
passed
11 months ago
Stage: code_quality
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/rwm-backups.conf
+6
-10
6 additions, 10 deletions
examples/rwm-backups.conf
rwm.py
+11
-1
11 additions, 1 deletion
rwm.py
tests/test_rwm.py
+2
-1
2 additions, 1 deletion
tests/test_rwm.py
with
19 additions
and
12 deletions
examples/rwm-backups.conf
+
6
−
10
View file @
2acfbf24
...
@@ -18,25 +18,21 @@ backups:
...
@@ -18,25 +18,21 @@ backups:
-
"/var/lib/mysql/*"
-
"/var/lib/mysql/*"
-
"/var/lib/postgresql/*"
-
"/var/lib/postgresql/*"
-
"/var/run/*"
-
"/var/run/*"
extras
: [
"--one-file-system"
,
"--tag"
,
"simplefs"
]
tags
:
-
"simplefs"
extras
:
-
"--one-file-system"
mysql
:
mysql
:
filesdirs
:
filesdirs
:
- /
var
/
lib
/
rwm
/
mysql
.
tar
.
gz
- /
var
/
lib
/
rwm
/
mysql
.
tar
.
gz
extras
: [
"--tag"
,
"mysql"
]
tags
:
-
"mysql"
prerun
:
prerun
:
-
"/opt/rwm/scripts/backup_mysql.py create"
-
"/opt/rwm/scripts/backup_mysql.py create"
postrun
:
postrun
:
-
"/opt/rwm/scripts/backup_mysql.py cleanup"
-
"/opt/rwm/scripts/backup_mysql.py cleanup"
nas
:
filesdirs
:
- /
mnt
/
nas
prerun
:
-
mount
postrun
:
-
unmount
retention
:
retention
:
keep
-
daily
:
"60"
keep
-
daily
:
"60"
keep
-
within
:
"60d"
keep
-
within
:
"60d"
...
...
This diff is collapsed.
Click to expand it.
rwm.py
+
11
−
1
View file @
2acfbf24
...
@@ -79,6 +79,9 @@ class BackupConfig(BaseModel):
...
@@ -79,6 +79,9 @@ class BackupConfig(BaseModel):
excludes:
excludes:
List of patterns for `--exclude` options for `restic backup` commmand. Defaults to an empty list.
List of patterns for `--exclude` options for `restic backup` commmand. Defaults to an empty list.
tags:
List of tags for the new backup snapshot. Defaults to an empty list.
extras:
extras:
Additional options for the `restic backup` commmand. Defaults to an empty list.
Additional options for the `restic backup` commmand. Defaults to an empty list.
...
@@ -93,6 +96,7 @@ class BackupConfig(BaseModel):
...
@@ -93,6 +96,7 @@ class BackupConfig(BaseModel):
filesdirs
:
List
[
str
]
filesdirs
:
List
[
str
]
excludes
:
List
[
str
]
=
[]
excludes
:
List
[
str
]
=
[]
tags
:
List
[
str
]
=
[]
extras
:
List
[
str
]
=
[]
extras
:
List
[
str
]
=
[]
prerun
:
List
[
str
]
=
[]
prerun
:
List
[
str
]
=
[]
postrun
:
List
[
str
]
=
[]
postrun
:
List
[
str
]
=
[]
...
@@ -552,10 +556,16 @@ class RWM:
...
@@ -552,10 +556,16 @@ class RWM:
logger
.
info
(
f
"
_restic_backup
{
name
}
"
)
logger
.
info
(
f
"
_restic_backup
{
name
}
"
)
conf
=
self
.
config
.
backups
[
name
]
conf
=
self
.
config
.
backups
[
name
]
excludes
=
[]
excludes
=
[]
for
item
in
conf
.
excludes
:
for
item
in
conf
.
excludes
:
excludes
+=
[
"
--exclude
"
,
item
]
excludes
+=
[
"
--exclude
"
,
item
]
cmd_args
=
[
"
backup
"
]
+
conf
.
extras
+
excludes
+
conf
.
filesdirs
tags
=
[]
for
item
in
conf
.
tags
:
tags
+=
[
"
--tag
"
,
item
]
cmd_args
=
[
"
backup
"
]
+
conf
.
extras
+
tags
+
excludes
+
conf
.
filesdirs
wrap_output
(
backup_proc
:
=
self
.
restic_cmd
(
cmd_args
))
wrap_output
(
backup_proc
:
=
self
.
restic_cmd
(
cmd_args
))
return
backup_proc
.
returncode
return
backup_proc
.
returncode
...
...
This diff is collapsed.
Click to expand it.
tests/test_rwm.py
+
2
−
1
View file @
2acfbf24
...
@@ -128,7 +128,8 @@ def test_backup(tmpworkdir: str, motoserver: str): # pylint: disable=unused-arg
...
@@ -128,7 +128,8 @@ def test_backup(tmpworkdir: str, motoserver: str): # pylint: disable=unused-arg
"
testcfg
"
:
{
"
testcfg
"
:
{
"
filesdirs
"
:
[
"
testdatadir/
"
],
"
filesdirs
"
:
[
"
testdatadir/
"
],
"
excludes
"
:
[
"
testfile_to_be_ignored
"
],
"
excludes
"
:
[
"
testfile_to_be_ignored
"
],
"
extras
"
:
[
"
--tag
"
,
"
dummytag
"
],
"
tags
"
:
[
"
dummytag
"
],
"
extras
"
:
[
"
--one-file-system
"
],
}
}
},
},
"
retention
"
:
{
"
retention
"
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment