Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos
Commits
4269eb18
Commit
4269eb18
authored
Dec 04, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format exception before printing it
parent
2cd488ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
slapos/recipe/request.py
slapos/recipe/request.py
+5
-3
No files found.
slapos/recipe/request.py
View file @
4269eb18
...
@@ -25,9 +25,9 @@
...
@@ -25,9 +25,9 @@
#
#
##############################################################################
##############################################################################
import
logging
import
logging
from
slapos
import
slap
as
slapmodule
from
slapos
import
slap
as
slapmodule
import
slapos.recipe.librecipe.generic
as
librecipe
import
slapos.recipe.librecipe.generic
as
librecipe
import
traceback
DEFAULT_SOFTWARE_TYPE
=
'RootSoftwareInstance'
DEFAULT_SOFTWARE_TYPE
=
'RootSoftwareInstance'
...
@@ -125,6 +125,7 @@ class Recipe(object):
...
@@ -125,6 +125,7 @@ class Recipe(object):
librecipe
.
GenericBaseRecipe
.
TRUE_VALUES
librecipe
.
GenericBaseRecipe
.
TRUE_VALUES
self
.
_raise_request_exception
=
None
self
.
_raise_request_exception
=
None
self
.
_raise_request_exception_formatted
=
None
self
.
instance
=
None
self
.
instance
=
None
try
:
try
:
self
.
instance
=
request
(
software_url
,
software_type
,
self
.
instance
=
request
(
software_url
,
software_type
,
...
@@ -134,6 +135,7 @@ class Recipe(object):
...
@@ -134,6 +135,7 @@ class Recipe(object):
options
[
'instance_guid'
]
=
self
.
instance
.
getId
()
options
[
'instance_guid'
]
=
self
.
instance
.
getId
()
except
(
slapmodule
.
NotFoundError
,
slapmodule
.
ServerError
,
slapmodule
.
ResourceNotReady
)
as
exc
:
except
(
slapmodule
.
NotFoundError
,
slapmodule
.
ServerError
,
slapmodule
.
ResourceNotReady
)
as
exc
:
self
.
_raise_request_exception
=
exc
self
.
_raise_request_exception
=
exc
self
.
_raise_request_exception_formatted
=
traceback
.
format_exc
()
for
param
in
return_parameters
:
for
param
in
return_parameters
:
options
[
'connection-%s'
%
param
]
=
''
options
[
'connection-%s'
%
param
]
=
''
...
@@ -176,9 +178,9 @@ class RequestOptional(Recipe):
...
@@ -176,9 +178,9 @@ class RequestOptional(Recipe):
Same as slapos.cookbook:request, but won't raise in case of problem.
Same as slapos.cookbook:request, but won't raise in case of problem.
"""
"""
def
install
(
self
):
def
install
(
self
):
if
self
.
_raise_request_exception
:
if
self
.
_raise_request_exception
_formatted
:
self
.
logger
.
warning
(
'Optional request failed:'
)
self
.
logger
.
warning
(
'Optional request failed:'
)
self
.
logger
.
warning
(
self
.
_raise_request_exception
)
self
.
logger
.
warning
(
self
.
_raise_request_exception
_formatted
)
elif
self
.
failed
is
not
None
:
elif
self
.
failed
is
not
None
:
# Check instance status to know if instance has been deployed
# Check instance status to know if instance has been deployed
try
:
try
:
...
...
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