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
Titouan Soulard
slapos.core
Commits
37a2bb6b
Commit
37a2bb6b
authored
Jun 30, 2022
by
Cédric Le Ninivin
Committed by
Titouan Soulard
Nov 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: Add tools to get and search Shared/Slave Instances
parent
944ee14f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
198 additions
and
40 deletions
+198
-40
master/bt5/slapos_jio_api_style/ActionTemplateItem/portal_types/Slave%20Instance/slapos_jio_api_get_software_instance.xml
...Slave%20Instance/slapos_jio_api_get_software_instance.xml
+85
-0
master/bt5/slapos_jio_api_style/PathTemplateItem/portal_callables/jIOWebSection_searchInstanceFromJSON.xml
...portal_callables/jIOWebSection_searchInstanceFromJSON.xml
+53
-23
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
...l_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
+4
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_searchInstance.py
...rtal_skins/slapos_jio_api/jIOWebSection_searchInstance.py
+55
-16
master/bt5/slapos_jio_api_style/bt/template_action_path_list
master/bt5/slapos_jio_api_style/bt/template_action_path_list
+1
-0
No files found.
master/bt5/slapos_jio_api_style/ActionTemplateItem/portal_types/Slave%20Instance/slapos_jio_api_get_software_instance.xml
0 → 100644
View file @
37a2bb6b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_slapos_json_get
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_slapos_json_get
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_jio_api_get_software_instance
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Get Software Instance
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/SoftwareInstance_getFromJSON
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio_api_style/PathTemplateItem/portal_callables/jIOWebSection_searchInstanceFromJSON.xml
View file @
37a2bb6b
...
@@ -73,32 +73,62 @@
...
@@ -73,32 +73,62 @@
"$schema": "http://json-schema.org/draft-07/schema#",\n
"$schema": "http://json-schema.org/draft-07/schema#",\n
"$id": "software-instance-base-schema.json",\n
"$id": "software-instance-base-schema.json",\n
"title": "Software Instance",\n
"title": "Software Instance",\n
"description": "Software Instance",\n
"description": "Software Instance
Search
",\n
"type": "object",\n
"type": "object",\n
"properties": {\n
"oneOf": [\n
"title": {\n
{\n
"title": "Title",\n
"properties": {\n
"type": "string",\n
"title": {\n
"description": "Unique Name of the Software Instance",\n
"title": "Title",\n
"maxLength": 200\n
"type": "string",\n
},\n
"description": "Unique Name of the Software Instance",\n
"compute_node_id": {\n
"maxLength": 200\n
"title": "Compute Node ID",\n
},\n
"type": "string",\n
"compute_node_id": {\n
"description": "The Id of the compute node hosting the instance, example: COMP-1234"\n
"title": "Compute Node ID",\n
},\n
"type": "string",\n
"root_instante_title": {\n
"description": "The Id of the compute node hosting the instance, example: COMP-1234"\n
"title": "Root Instance Title",\n
},\n
"type": "string",\n
"root_instante_title": {\n
"description": "Title of the Instance at the root of the instance tree. This is the title of the instance that has been requested by the user."\n
"title": "Root Instance Title",\n
"type": "string",\n
"description": "Title of the Instance at the root of the instance tree. This is the title of the instance that has been requested by the user."\n
},\n
"portal_type": {\n
"title": "Portal Type",\n
"const": "Software Instance",\n
"type": "string"\n
}\n
},\n
"required": ["portal_type"]\n
},\n
},\n
"portal_type": {\n
{\n
"title": "Portal Type",\n
"properties": {\n
"const": "Software Instance",\n
"title": {\n
"type": "string"\n
"title": "Title",\n
"type": "string",\n
"description": "Unique Name of the Software Instance",\n
"maxLength": 200\n
},\n
"host_instance_reference": {\n
"title": "Host Instance Reference",\n
"type": "string",\n
"description": "Reference of the Instance where this is instance is hosted, usefull for shared instances"\n
},\n
"root_instante_title": {\n
"title": "Root Instance Title",\n
"type": "string",\n
"description": "Title of the Instance at the root of the instance tree. This is the title of the instance that has been requested by the user."\n
},\n
"portal_type": {\n
"title": "Portal Type",\n
"const": "Shared Instance",\n
"type": "string"\n
}\n
},\n
"required": ["portal_type"]\n
}\n
}\n
},\n
]\n
"required": ["portal_type"]\n
}\n
}\n
</string>
</value>
</string>
</value>
</item>
</item>
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_getObjectFromData.py
View file @
37a2bb6b
...
@@ -11,7 +11,10 @@ if portal_type == "Software Installation":
...
@@ -11,7 +11,10 @@ if portal_type == "Software Installation":
elif
portal_type
==
"Software Instance"
:
elif
portal_type
==
"Software Instance"
:
if
"reference"
in
data_dict
:
if
"reference"
in
data_dict
:
software_instance
=
portal
.
portal_catalog
.
getSoftwareInstanceObject
(
data_dict
[
"reference"
])
software_instance
=
portal
.
portal_catalog
.
getSoftwareInstanceObject
(
data_dict
[
"reference"
],
include_shared
=
True
)
if
software_instance
:
if
software_instance
:
return
software_instance
return
software_instance
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_searchInstance.py
View file @
37a2bb6b
search_kw
=
{
portal_type
=
data_dict
[
"portal_type"
]
"portal_type"
:
"Software Instance"
,
portal
=
context
.
getPortalObject
()
"validation_state"
:
"validated"
,
"select_list"
:
(
"title"
,
"reference"
,
"portal_type"
)
}
if
"title"
in
data_dict
:
if
portal_type
==
"Software Instance"
:
search_kw
[
"title"
]
=
data_dict
[
"title"
]
search_kw
=
{
if
"compute_node_id"
in
data_dict
:
"portal_type"
:
"Software Instance"
,
search_kw
[
"aggregate_parent_reference"
]
=
data_dict
[
"compute_node_id"
]
"validation_state"
:
"validated"
,
if
"root_instante_title"
in
data_dict
:
"select_list"
:
(
"title"
,
"reference"
,
"portal_type"
)
search_kw
[
"strict_specialise_title"
]
=
data_dict
[
"root_instante_title"
]
}
if
"title"
in
data_dict
:
search_kw
[
"title"
]
=
data_dict
[
"title"
]
if
"compute_node_id"
in
data_dict
:
search_kw
[
"aggregate_parent_reference"
]
=
data_dict
[
"compute_node_id"
]
if
"root_instante_title"
in
data_dict
:
search_kw
[
"strict_specialise_title"
]
=
data_dict
[
"root_instante_title"
]
result_list
=
[{
"title"
:
x
.
title
,
"reference"
:
x
.
reference
,
"portal_type"
:
x
.
portal_type
,
}
for
x
in
portal
.
portal_catalog
(
**
search_kw
)]
elif
portal_type
==
"Shared Instance"
:
search_kw
=
{
"portal_type"
:
"Slave Instance"
,
"validation_state"
:
"validated"
,
"select_list"
:
(
"title"
,
"reference"
,
"portal_type"
)
}
if
"host_instance_reference"
in
data_dict
:
host_instance_list
=
portal
.
portal_catalog
(
portal_type
=
"Software Instance"
,
reference
=
data_dict
[
"host_instance_reference"
],
validation_state
=
"validated"
,
)
if
len
(
host_instance_list
)
!=
1
:
return
portal
.
ERP5Site_logApiErrorAndReturn
(
error_name
=
"HOST-INSTANCE-NOT-FOUND"
,
error_message
=
"No matching instances with the provided reference has been found"
,
error_code
=
404
)
search_kw
[
"strict_aggregate_uid"
]
=
host_instance_list
[
0
].
getObject
().
getAggregateUid
()
if
"root_instante_title"
in
data_dict
:
search_kw
[
"strict_specialise_title"
]
=
data_dict
[
"root_instante_title"
]
#return portal.portal_catalog(src__=1, **search_kw)
result_list
=
[{
"title"
:
x
.
title
,
"reference"
:
x
.
reference
,
"portal_type"
:
x
.
portal_type
,
}
for
x
in
portal
.
portal_catalog
(
**
search_kw
)]
else
:
return
portal
.
ERP5Site_logApiErrorAndReturn
(
error_name
=
"UNREACHABLE"
,
error_message
=
"You Reached code that was not recheable"
,
)
result_list
=
[{
"title"
:
x
.
title
,
"reference"
:
x
.
reference
,
"portal_type"
:
x
.
portal_type
,
}
for
x
in
context
.
getPortalObject
().
portal_catalog
(
**
search_kw
)]
import
json
import
json
return
json
.
dumps
({
return
json
.
dumps
({
"$schema"
:
json_form
.
absolute_url
().
strip
()
+
"/getOutputJSONSchema"
,
"$schema"
:
json_form
.
absolute_url
().
strip
()
+
"/getOutputJSONSchema"
,
...
...
master/bt5/slapos_jio_api_style/bt/template_action_path_list
View file @
37a2bb6b
Slave Instance | slapos_jio_api_get_software_instance
Software Installation | slapos_jio_api_put_software_installation
Software Installation | slapos_jio_api_put_software_installation
Software Instance | slapos_jio_api_get_software_instance
Software Instance | slapos_jio_api_get_software_instance
jIO Web Section | slapos_jio_api_create_compute_node
jIO Web Section | slapos_jio_api_create_compute_node
...
...
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