Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Thomas Gambier
slapos.core
Commits
bcd8c217
Commit
bcd8c217
authored
Mar 28, 2018
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid.promise: add the promise name when raising PromiseError
parent
2f76fd28
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
slapos/grid/promise/__init__.py
slapos/grid/promise/__init__.py
+7
-7
slapos/tests/promise.py
slapos/tests/promise.py
+2
-2
No files found.
slapos/grid/promise/__init__.py
View file @
bcd8c217
...
...
@@ -352,7 +352,7 @@ class PromiseLauncher(object):
Run all promises
"""
promise_list
=
[]
promise_failed
=
False
failed_promise_name
=
""
base_config
=
{
'log-folder'
:
self
.
log_folder
,
'partition-folder'
:
self
.
partition_folder
,
...
...
@@ -399,8 +399,8 @@ class PromiseLauncher(object):
module
=
reload
(
module
)
config
.
update
(
base_config
)
if
self
.
_launchPromise
(
name
,
config
,
module
)
and
not
promise_failed
:
promise_failed
=
Tru
e
if
self
.
_launchPromise
(
name
,
config
,
module
)
and
not
failed_promise_name
:
failed_promise_name
=
nam
e
if
not
self
.
run_only_promise_list
and
os
.
path
.
exists
(
self
.
legacy_promise_folder
)
\
and
os
.
path
.
isdir
(
self
.
legacy_promise_folder
):
...
...
@@ -418,11 +418,11 @@ class PromiseLauncher(object):
}
config
.
update
(
base_config
)
# We will use promise wrapper to run this
if
self
.
_launchPromise
(
promise_name
,
config
)
and
not
promise_failed
:
promise_failed
=
Tru
e
if
self
.
_launchPromise
(
promise_name
,
config
)
and
not
failed_promise_name
:
failed_promise_name
=
promise_nam
e
stat_info
=
os
.
stat
(
self
.
partition_folder
)
chownDirectory
(
self
.
partition_folder
,
stat_info
.
st_uid
,
stat_info
.
st_gid
)
if
promise_failed
:
raise
PromiseError
(
"Promise
(s) has failed."
)
if
failed_promise_name
:
raise
PromiseError
(
"Promise
%r failed."
%
failed_promise_name
)
slapos/tests/promise.py
View file @
bcd8c217
...
...
@@ -443,7 +443,7 @@ class RunPromise(GenericPromise):
# run promise will fail when promise fail (usefull for slapgrid)
with
self
.
assertRaises
(
PromiseError
)
as
exc
:
self
.
launcher
.
run
()
self
.
assertEquals
(
exc
.
exception
.
message
,
'Promise
(s) has failed.'
)
self
.
assertEquals
(
exc
.
exception
.
message
,
'Promise
%r failed.'
%
second_promise
)
if
"my_second_promise"
in
sys
.
modules
:
# force to reload the module without rerun python
...
...
@@ -618,7 +618,7 @@ exit 1
state_file
=
os
.
path
.
join
(
self
.
partition_dir
,
PROMISE_STATE_FOLDER_NAME
)
with
self
.
assertRaises
(
PromiseError
)
as
exc
:
self
.
launcher
.
run
()
self
.
assertEquals
(
exc
.
exception
.
message
,
'Promise
(s) has failed.'
)
self
.
assertEquals
(
exc
.
exception
.
message
,
'Promise
%r failed.'
%
promise_name
)
def
test_runpromise_wrapped_mixed
(
self
):
self
.
called
=
0
...
...
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