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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.toolbox
Commits
0ac11c83
Commit
0ac11c83
authored
Apr 02, 2019
by
Thomas Gambier
Committed by
Thomas Gambier
Apr 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[runner] support broken symlinks in writeSignatureFile
parent
0177ace5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
slapos/resilient/runner_utils.py
slapos/resilient/runner_utils.py
+5
-5
slapos/test/test_runner_exporter.py
slapos/test/test_runner_exporter.py
+8
-1
No files found.
slapos/resilient/runner_utils.py
View file @
0ac11c83
...
...
@@ -124,9 +124,12 @@ def writeSignatureFile(slappart_signature_method_dict, runner_working_path, sign
)
break
# construct list of file path and remove broken symlink
filepath_list
=
filter
(
os
.
path
.
isfile
,
[
os
.
path
.
join
(
dirpath
,
filename
)
for
filename
in
filename_list
])
if
signature_process
:
(
output
,
error_output
)
=
signature_process
.
communicate
(
'
\
0
'
.
join
(
[
os
.
path
.
join
(
dirpath
,
filename
)
for
filename
in
filename_list
]
)
'
\
0
'
.
join
(
filepath_list
)
)
if
signature_process
.
returncode
!=
0
:
...
...
@@ -143,10 +146,7 @@ def writeSignatureFile(slappart_signature_method_dict, runner_working_path, sign
signature_list
.
extend
(
output
.
strip
(
'
\
n
'
).
split
(
'
\
n
'
))
else
:
signature_list
.
extend
(
getSha256Sum
([
os
.
path
.
join
(
dirpath
,
filename
)
for
filename
in
filename_list
])
getSha256Sum
(
filepath_list
)
)
# Write the signatures in file
...
...
slapos/test/test_runner_exporter.py
View file @
0ac11c83
...
...
@@ -180,6 +180,10 @@ class TestRunnerExporter(unittest.TestCase):
self
.
_createFile
(
'backup/runner/instance/slappart0/data'
,
'hello'
)
self
.
_createFile
(
'backup/runner/instance/slappart1/data'
,
'world'
)
os
.
symlink
(
'data'
,
'backup/runner/instance/slappart0/good_link'
)
os
.
symlink
(
os
.
path
.
abspath
(
'backup/runner/instance/slappart0/data'
),
'backup/runner/instance/slappart0/good_abs_link'
)
os
.
symlink
(
'unexisting_file'
,
'backup/runner/instance/slappart0/bad_link'
)
slappart_signature_method_dict
=
{
'./instance/slappart1'
:
'./instance/slappart1/srv/.backup_identity_script'
,
}
...
...
@@ -191,7 +195,10 @@ class TestRunnerExporter(unittest.TestCase):
signature_file_content
=
f
.
read
()
# Slappart1 is using md5sum as signature, others are using sha256sum (default)
self
.
assertEqual
(
signature_file_content
,
"""2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 ./runner/instance/slappart0/data
self
.
assertEqual
(
signature_file_content
,
"""2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 ./runner/instance/slappart0/data
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 ./runner/instance/slappart0/good_abs_link
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 ./runner/instance/slappart0/good_link
49b74873d57ff0307b7c9364e2fe2a3876d8722fbe7ce3a6f1438d47647a86f4 ./etc/.project
7d793037a0760186574b0282f2f435e7 ./runner/instance/slappart1/data"""
)
...
...
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