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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
da0b6ca3
Commit
da0b6ca3
authored
Mar 09, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: Finish create Compute Node process
parent
f30631b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
59 deletions
+51
-59
master/bt5/slapos_jio_api_style/PathTemplateItem/portal_callables/jIOWebSection_createComputeNodeFromJSON.xml
...tal_callables/jIOWebSection_createComputeNodeFromJSON.xml
+1
-27
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/ComputeNode_approveComputer.py
...ortal_skins/slapos_jio_api/ComputeNode_approveComputer.py
+6
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/ComputeNode_approveComputer.xml
...rtal_skins/slapos_jio_api/ComputeNode_approveComputer.xml
+1
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_createComputeNode.py
...l_skins/slapos_jio_api/jIOWebSection_createComputeNode.py
+43
-30
No files found.
master/bt5/slapos_jio_api_style/PathTemplateItem/portal_callables/jIOWebSection_createComputeNodeFromJSON.xml
View file @
da0b6ca3
...
...
@@ -44,35 +44,9 @@
"title": "Title",\n
"type": "string",\n
"maxLength": 200\n
},\n
"network": {},\n
"site": {},\n
"project": {},\n
"monitoring": {},\n
"capacity_scope": {},\n
"upgrade_scope": {},\n
"allocation_scope": {\n
"type": "string"\n
},\n
"os_type": {\n
"title": "OS Type",\n
"type": "string",\n
"description": "Type of the OS of the current Compute Node"\n
},\n
"public_ipv4_address": {\n
"title": "Public IPV4 Address",\n
"type":"string"\n
},\n
"python_version": {\n
"title": "Python Version",\n
"type": "string"\n
},\n
"slapos_version": {\n
"title": "SlapOS Version",\n
"type": "string"\n
}\n
},\n
"required": ["
title", "
portal_type"]\n
"required": ["portal_type"]\n
}\n
</string>
</value>
</item>
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/ComputeNode_approveComputer.py
View file @
da0b6ca3
...
...
@@ -9,8 +9,13 @@ if person is None:
response
.
setStatus
(
403
)
else
:
compute_node
=
context
compute_node
.
generateCertificate
()
if
title
:
compute_node
.
edit
(
title
=
title
)
else
:
# Make sure a title is defined
compute_node
.
setTitle
(
compute_node
.
getTitle
())
compute_node
.
approveComputeNodeRegistration
()
compute_node
.
generateCertificate
()
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
"certificate"
:
request
.
get
(
'compute_node_certificate'
),
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/ComputeNode_approveComputer.xml
View file @
da0b6ca3
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
title=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_createComputeNode.py
View file @
da0b6ca3
log_error
=
context
.
ERP5Site_logApiErrorAndReturn
import
json
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
...
@@ -8,32 +7,46 @@ response = request.RESPONSE
if
person
is
None
:
response
.
setStatus
(
403
)
else
:
request_kw
=
dict
(
compute_node_title
=
data_dict
[
"title"
],
approve_registration
=
False
,
)
person
.
requestComputeNode
(
**
request_kw
)
compute_node
=
context
.
restrictedTraverse
(
context
.
REQUEST
.
get
(
'compute_node'
))
web_site
=
context
.
getWebSiteValue
()
slapos_master_web_url
=
web_site
.
getLayoutProperty
(
"configuration_slapos_master_web_url"
,
default
=
web_site
.
absolute_url
()
)
request_url
=
"%s/%s"
%
(
slapos_master_web_url
,
"%s/ComputeNode_approveComputer"
%
compute_node
.
getRelativeUrl
())
person
.
requestToken
(
request_url
=
request_url
)
access_token_id
=
context
.
REQUEST
.
get
(
"token"
)
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
"$schema"
:
context
.
getPortalObject
().
portal_types
.
restrictedTraverse
(
compute_node
.
getPortalType
()).
absolute_url
()
+
"/getTextContent"
,
"title"
:
compute_node
.
getTitle
(),
"id"
:
compute_node
.
getRelativeUrl
(),
"reference"
:
compute_node
.
getReference
(),
"access_token"
:
"V2/"
+
compute_node
.
getId
()
+
"/"
+
access_token_id
,
"access_token_url"
:
request_url
,
"modification_date"
:
compute_node
.
getModificationDate
().
HTML4
(),
})
return
request_kw
=
dict
(
compute_node_title
=
data_dict
.
get
(
"title"
,
None
),
approve_registration
=
False
,
)
person
.
requestComputeNode
(
**
request_kw
)
compute_node
=
context
.
restrictedTraverse
(
context
.
REQUEST
.
get
(
'compute_node'
))
web_site
=
context
.
getWebSiteValue
()
slapos_master_web_url
=
web_site
.
getLayoutProperty
(
"configuration_slapos_master_web_url"
,
default
=
web_site
.
absolute_url
()
)
request_url
=
"%s/%s"
%
(
slapos_master_web_url
.
strip
(
"/"
),
"%s/ComputeNode_approveComputer"
%
compute_node
.
getRelativeUrl
())
person
.
requestToken
(
request_url
=
request_url
)
access_token_id
=
context
.
REQUEST
.
get
(
"token"
)
slapos_master_api
=
web_site
.
getLayoutProperty
(
"configuration_slapos_master_api"
,
"https://slap.vifib.com"
)
compute_node_install_command_line
=
web_site
.
getLayoutProperty
(
"configuration_compute_node_install_command_line"
,
"wget https://deploy.erp5.net/slapos ; bash slapos"
)
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
"$schema"
:
context
.
getPortalObject
().
portal_types
.
restrictedTraverse
(
compute_node
.
getPortalType
()).
absolute_url
()
+
"/getTextContent"
,
"title"
:
compute_node
.
getTitle
(),
"id"
:
compute_node
.
getRelativeUrl
(),
"reference"
:
compute_node
.
getReference
(),
"access_token"
:
"V2/"
+
compute_node
.
getId
()
+
"/"
+
access_token_id
,
"certificate_url_access"
:
request_url
,
"initialisation_comand"
:
compute_node_install_command_line
,
"slapos_master_web"
:
slapos_master_web_url
,
"slapos_master_api"
:
slapos_master_api
,
"modification_date"
:
compute_node
.
getModificationDate
().
HTML4
(),
# Kept for backward compatibility
"command_line"
:
compute_node_install_command_line
,
})
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