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
0c0b9a6e
Commit
0c0b9a6e
authored
Oct 12, 2023
by
Titouan Soulard
Committed by
Romain Courteaud
Nov 27, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: update references to project_reference
parent
a944e6ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_requestSoftwareInstance.py
...s/slapos_jio_api/jIOWebSection_requestSoftwareInstance.py
+11
-5
master/bt5/slapos_jio_api_style/TestTemplateItem/portal_components/test.erp5.testSlapOSJIOAPI.py
...plateItem/portal_components/test.erp5.testSlapOSJIOAPI.py
+3
-9
No files found.
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_requestSoftwareInstance.py
View file @
0c0b9a6e
import
json
import
urllib
compute_node_id
=
data_dict
.
get
(
"compute_node_id"
,
None
)
compute_partition_id
=
data_dict
.
get
(
"compute_partition_id"
,
None
)
...
...
@@ -19,7 +22,6 @@ portal = context.getPortalObject()
# Loads partition parameter
partition_parameter
=
data_dict
.
get
(
"parameters"
,
None
)
if
partition_parameter
:
import
json
try
:
partition_parameter
=
json
.
loads
(
partition_parameter
)
except
ValueError
,
e
:
...
...
@@ -41,7 +43,6 @@ try:
filter_kw
=
data_dict
.
get
(
"sla_parameters"
,
{})
partition_reference
=
data_dict
.
get
(
"title"
)
import
urllib
kw
=
dict
(
software_release
=
urllib
.
unquote
(
data_dict
.
get
(
"software_release_uri"
)),
software_type
=
data_dict
.
get
(
"software_type"
,
"RootSoftwareInstance"
),
software_title
=
partition_reference
,
...
...
@@ -49,7 +50,7 @@ try:
shared
=
data_dict
.
get
(
"shared"
,
False
),
sla_xml
=
castToStr
(
filter_kw
),
state
=
data_dict
.
get
(
"state"
,
"started"
),
project_reference
=
data_dict
.
get
(
"project_reference"
))
project_reference
=
data_dict
.
get
(
"project_reference"
,
None
))
if
compute_node_id
and
compute_partition_id
:
compute_partition
=
portal
.
portal_catalog
.
getComputePartitionObject
(
...
...
@@ -58,8 +59,13 @@ try:
)
requester
=
compute_partition
.
getSoftwareInstance
()
instance_tree
=
requester
.
getSpecialiseValue
()
if
instance_tree
is
not
None
and
instance_tree
.
getSlapState
()
==
"stop_requested"
:
kw
[
'state'
]
=
'stopped'
if
instance_tree
is
not
None
:
kw
[
"project_reference"
]
=
instance_tree
.
getFollowUpReference
()
if
instance_tree
.
getSlapState
()
==
"stop_requested"
:
kw
[
'state'
]
=
'stopped'
key
=
'_'
.
join
([
instance_tree
.
getRelativeUrl
(),
partition_reference
])
else
:
# requested as root, so done by human
...
...
master/bt5/slapos_jio_api_style/TestTemplateItem/portal_components/test.erp5.testSlapOSJIOAPI.py
View file @
0c0b9a6e
...
...
@@ -975,13 +975,11 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try
:
requestInstance
=
instance
.
__class__
.
requestInstance
project_reference
=
self
.
project
.
getReference
()
instance
.
__class__
.
requestInstance
=
calledRequestInstance
partition_id
=
instance
.
getAggregateValue
(
portal_type
=
'Compute Partition'
).
getReference
()
self
.
login
(
instance
.
getUserId
())
response_dict
=
self
.
postToApi
({
"portal_type"
:
"Software Instance"
,
"project_reference"
:
project_reference
,
"software_release_uri"
:
"req_release"
,
"software_type"
:
"req_type"
,
"title"
:
"req_reference"
,
...
...
@@ -996,7 +994,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response
.
headers
.
get
(
'content-type'
))
self
.
assertEqual
(
self
.
called_instance_request
,
{
'instance_xml'
:
"<?xml version='1.0' encoding='utf-8'?>
\
n
<instance/>
\
n
"
,
"project_reference"
:
project_reference
,
'project_reference'
:
self
.
project
.
getReference
()
,
'software_title'
:
'req_reference'
,
'software_release'
:
'req_release'
,
'state'
:
'started'
,
...
...
@@ -1024,13 +1022,11 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try
:
requestInstance
=
instance
.
__class__
.
requestInstance
project_reference
=
self
.
project
.
getReference
()
instance
.
__class__
.
requestInstance
=
calledRequestInstance
partition_id
=
instance
.
getAggregateValue
(
portal_type
=
'Compute Partition'
).
getReference
()
self
.
login
(
instance
.
getUserId
())
response_dict
=
self
.
postToApi
({
"portal_type"
:
"Software Instance"
,
"project_reference"
:
project_reference
,
"software_release_uri"
:
"req_release"
,
"software_type"
:
"req_type"
,
"title"
:
"req_reference"
,
...
...
@@ -1044,7 +1040,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response
.
headers
.
get
(
'content-type'
))
self
.
assertEqual
(
self
.
called_instance_request
,
{
'instance_xml'
:
"<?xml version='1.0' encoding='utf-8'?>
\
n
<instance/>
\
n
"
,
"project_reference"
:
project_reference
,
'project_reference'
:
self
.
project
.
getReference
()
,
'software_title'
:
'req_reference'
,
'software_release'
:
'req_release'
,
'shared'
:
False
,
...
...
@@ -1072,13 +1068,11 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try
:
requestInstance
=
instance
.
__class__
.
requestInstance
project_reference
=
self
.
project
.
getReference
()
instance
.
__class__
.
requestInstance
=
calledRequestInstance
partition_id
=
instance
.
getAggregateValue
(
portal_type
=
'Compute Partition'
).
getReference
()
self
.
login
(
instance
.
getUserId
())
response_dict
=
self
.
postToApi
({
"portal_type"
:
"Software Instance"
,
"project_reference"
:
project_reference
,
"software_release_uri"
:
"req_release"
,
"software_type"
:
"req_type"
,
"title"
:
"req_reference"
,
...
...
@@ -1093,7 +1087,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response
.
headers
.
get
(
'content-type'
))
self
.
assertEqual
(
self
.
called_instance_request
,
{
'instance_xml'
:
"<?xml version='1.0' encoding='utf-8'?>
\
n
<instance/>
\
n
"
,
"project_reference"
:
project_reference
,
'project_reference'
:
self
.
project
.
getReference
()
,
'software_title'
:
'req_reference'
,
'software_release'
:
'req_release'
,
'shared'
:
False
,
...
...
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