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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
336fe219
Commit
336fe219
authored
Dec 16, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_json_rpc_api: fix error reporting
parent
cd4db4d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
master/bt5/slapos_json_rpc_api/SkinTemplateItem/portal_skins/slapos_jio_api/SoftwareInstance_updateFromDict.py
...l_skins/slapos_jio_api/SoftwareInstance_updateFromDict.py
+10
-11
No files found.
master/bt5/slapos_json_rpc_api/SkinTemplateItem/portal_skins/slapos_jio_api/SoftwareInstance_updateFromDict.py
View file @
336fe219
import
json
from
erp5.component.document.JsonRpcAPIService
import
JsonRpcAPIError
software_instance
=
context
class
WrongReportedStateError
(
JsonRpcAPIError
):
type
=
"SOFTWARE-INSTANCE-WRONG-REPORTED-STATE"
status
=
403
logError
=
context
.
ERP5Site_logApiErrorAndReturn
software_instance
=
context
.
jIOWebSection_getObjectFromData
(
data_dict
)
castToStr
=
context
.
Base_castDictToXMLString
castToStr
=
context
.
Base_castDictToXMLString
if
"connection_parameters"
in
data_dict
:
if
"connection_parameters"
in
data_dict
:
...
@@ -38,10 +40,7 @@ if "reported_state" in data_dict:
...
@@ -38,10 +40,7 @@ if "reported_state" in data_dict:
error_log
=
data_dict
.
get
(
"status_message"
,
""
)
error_log
=
data_dict
.
get
(
"status_message"
,
""
)
software_instance
.
setErrorStatus
(
'while instanciating: %s'
%
error_log
[
-
80
:],
reindex
=
1
)
software_instance
.
setErrorStatus
(
'while instanciating: %s'
%
error_log
[
-
80
:],
reindex
=
1
)
else
:
else
:
return
logError
(
raise
WrongReportedStateError
(
"Unexcepected Reported State: %s"
%
reported_state
)
error_name
=
"SOFTWARE-INSTANCE-WRONG-REPORTED-STATE"
,
error_message
=
"Unexcepected Reported State: %s"
%
reported_state
,
)
if
"requested_instance_list"
in
data_dict
:
if
"requested_instance_list"
in
data_dict
:
software_instance
.
updateRequestedInstanceList
(
data_dict
[
"requested_instance_list"
])
software_instance
.
updateRequestedInstanceList
(
data_dict
[
"requested_instance_list"
])
...
@@ -52,10 +51,10 @@ if "title" in data_dict and data_dict["title"] != software_instance.getTitle():
...
@@ -52,10 +51,10 @@ if "title" in data_dict and data_dict["title"] != software_instance.getTitle():
comment
=
"Rename %s into %s"
%
(
software_instance
.
getTitle
(),
data_dict
[
"title"
])
comment
=
"Rename %s into %s"
%
(
software_instance
.
getTitle
(),
data_dict
[
"title"
])
)
)
return
json
.
dumps
(
{
return
{
"$schema"
:
json_form
.
absolute_url
().
strip
()
+
"/getOutputJSONSchema"
,
#
"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema",
"reference"
:
software_instance
.
getReference
(),
"reference"
:
software_instance
.
getReference
(),
"portal_type"
:
"Software Instance"
,
"portal_type"
:
"Software Instance"
,
"date"
:
DateTime
().
HTML4
(),
"date"
:
DateTime
().
ISO8601
(),
"success"
:
"Done"
"success"
:
"Done"
}
,
indent
=
2
)
}
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