Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
22dc274b
Commit
22dc274b
authored
Nov 05, 2018
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve call to rsync
parent
be10ba69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
slapos/resilient/runner_exporter.py
slapos/resilient/runner_exporter.py
+4
-4
slapos/test/test_runner_exporter.py
slapos/test/test_runner_exporter.py
+8
-8
No files found.
slapos/resilient/runner_exporter.py
View file @
22dc274b
...
...
@@ -85,13 +85,13 @@ def rsync(rsync_binary, source, destination, extra_args=None, dry=False):
return
try
:
subprocess
.
check_
call
(
arg_list
)
subprocess
.
check_
output
(
arg_list
)
except
subprocess
.
CalledProcessError
as
e
:
# All rsync errors are not to be considered as errors
allowed_error_message_
regex
=
\
allowed_error_message_
list
=
\
'^(file has vanished: |rsync warning: some files vanished before they could be transferred)'
if
e
.
returncode
not
in
(
0
,
24
)
or
\
re
.
match
(
allowed_error_message_regex
,
e
.
output
)
is
not
None
:
if
e
.
returncode
!=
24
or
\
re
.
search
(
allowed_error_message_regex
,
e
.
output
,
re
.
M
)
is
None
:
raise
e
...
...
slapos/test/test_runner_exporter.py
View file @
22dc274b
...
...
@@ -125,8 +125,8 @@ class TestRunnerExporter(unittest.TestCase):
)
@
mock
.
patch
(
'subprocess.check_
call
'
)
def
test_synchroniseRunnerConfigurationDirectory
(
self
,
check_
call
_mock
):
@
mock
.
patch
(
'subprocess.check_
output
'
)
def
test_synchroniseRunnerConfigurationDirectory
(
self
,
check_
output
_mock
):
self
.
_setUpFakeInstanceFolder
()
config
=
Config
()
config
.
rsync_binary
=
'rsync'
...
...
@@ -135,14 +135,14 @@ class TestRunnerExporter(unittest.TestCase):
runner_exporter
.
synchroniseRunnerConfigurationDirectory
(
config
,
'backup/runner/etc/'
)
self
.
assertEqual
(
check_
call
_mock
.
call_count
,
1
)
check_
call
_mock
.
assert_any_call
(
self
.
assertEqual
(
check_
output
_mock
.
call_count
,
1
)
check_
output
_mock
.
assert_any_call
(
[
'rsync'
,
'-rlptgov'
,
'--stats'
,
'--safe-links'
,
'--ignore-missing-args'
,
'--delete'
,
'--delete-excluded'
,
'config.json'
,
'.parameters.xml'
,
'.project'
,
'backup/runner/etc/'
]
)
@
mock
.
patch
(
'subprocess.check_
call
'
)
def
test_synchroniseRunnerWorkingDirectory
(
self
,
check_
call
_mock
):
@
mock
.
patch
(
'subprocess.check_
output
'
)
def
test_synchroniseRunnerWorkingDirectory
(
self
,
check_
output
_mock
):
self
.
_setUpFakeInstanceFolder
()
config
=
Config
()
config
.
rsync_binary
=
'rsync'
...
...
@@ -152,8 +152,8 @@ class TestRunnerExporter(unittest.TestCase):
config
,
'backup/runner/runner'
)
self
.
assertEqual
(
check_
call
_mock
.
call_count
,
1
)
check_
call
_mock
.
assert_any_call
(
self
.
assertEqual
(
check_
output
_mock
.
call_count
,
1
)
check_
output
_mock
.
assert_any_call
(
[
'rsync'
,
'-rlptgov'
,
'--stats'
,
'--safe-links'
,
'--ignore-missing-args'
,
'--delete'
,
'--delete-excluded'
,
'--exclude=*.sock'
,
'--exclude=*.socket'
,
'--exclude=*.pid'
,
'--exclude=.installed*.cfg'
,
'--exclude=srv/backup/**'
,
'--exclude=instance/slappart0/etc/nicolas.txt'
,
'--exclude=instance/slappart0/etc/rafael.txt'
,
'--exclude=srv/exporter.exclude'
,
'instance'
,
'project'
,
'public'
,
'proxy.db'
,
'backup/runner/runner'
]
)
...
...
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