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
Thomas Leymonerie
slapos.core
Commits
71e9708b
Commit
71e9708b
authored
Mar 09, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: Finish create Compute Node process
parent
9d2d56d1
Changes
4
Show 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 @
71e9708b
...
@@ -44,35 +44,9 @@
...
@@ -44,35 +44,9 @@
"title": "Title",\n
"title": "Title",\n
"type": "string",\n
"type": "string",\n
"maxLength": 200\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
},\n
},\n
"required": ["
title", "
portal_type"]\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/ComputeNode_approveComputer.py
View file @
71e9708b
...
@@ -9,8 +9,13 @@ if person is None:
...
@@ -9,8 +9,13 @@ if person is None:
response
.
setStatus
(
403
)
response
.
setStatus
(
403
)
else
:
else
:
compute_node
=
context
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
.
approveComputeNodeRegistration
()
compute_node
.
generateCertificate
()
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
return
json
.
dumps
({
"certificate"
:
request
.
get
(
'compute_node_certificate'
),
"certificate"
:
request
.
get
(
'compute_node_certificate'
),
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/ComputeNode_approveComputer.xml
View file @
71e9708b
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
title=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api/jIOWebSection_createComputeNode.py
View file @
71e9708b
log_error
=
context
.
ERP5Site_logApiErrorAndReturn
import
json
import
json
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
...
@@ -8,32 +7,46 @@ response = request.RESPONSE
...
@@ -8,32 +7,46 @@ response = request.RESPONSE
if
person
is
None
:
if
person
is
None
:
response
.
setStatus
(
403
)
response
.
setStatus
(
403
)
else
:
return
request_kw
=
dict
(
compute_node_title
=
data_dict
[
"title"
],
request_kw
=
dict
(
compute_node_title
=
data_dict
.
get
(
"title"
,
None
),
approve_registration
=
False
,
approve_registration
=
False
,
)
)
person
.
requestComputeNode
(
**
request_kw
)
person
.
requestComputeNode
(
**
request_kw
)
compute_node
=
context
.
restrictedTraverse
(
context
.
REQUEST
.
get
(
'compute_node'
))
compute_node
=
context
.
restrictedTraverse
(
context
.
REQUEST
.
get
(
'compute_node'
))
web_site
=
context
.
getWebSiteValue
()
web_site
=
context
.
getWebSiteValue
()
slapos_master_web_url
=
web_site
.
getLayoutProperty
(
slapos_master_web_url
=
web_site
.
getLayoutProperty
(
"configuration_slapos_master_web_url"
,
"configuration_slapos_master_web_url"
,
default
=
web_site
.
absolute_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"
)
request_url
=
"%s/%s"
%
(
slapos_master_web_url
,
"%s/ComputeNode_approveComputer"
%
compute_node
.
getRelativeUrl
())
compute_node_install_command_line
=
web_site
.
getLayoutProperty
(
"configuration_compute_node_install_command_line"
,
"wget https://deploy.erp5.net/slapos ; bash slapos"
)
person
.
requestToken
(
request_url
=
request_url
)
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
access_token_id
=
context
.
REQUEST
.
get
(
"token"
)
return
json
.
dumps
({
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
"$schema"
:
context
.
getPortalObject
().
portal_types
.
restrictedTraverse
(
compute_node
.
getPortalType
()).
absolute_url
()
"$schema"
:
context
.
getPortalObject
().
portal_types
.
restrictedTraverse
(
compute_node
.
getPortalType
()).
absolute_url
()
+
"/getTextContent"
,
+
"/getTextContent"
,
"title"
:
compute_node
.
getTitle
(),
"title"
:
compute_node
.
getTitle
(),
"id"
:
compute_node
.
getRelativeUrl
(),
"id"
:
compute_node
.
getRelativeUrl
(),
"reference"
:
compute_node
.
getReference
(),
"reference"
:
compute_node
.
getReference
(),
"access_token"
:
"V2/"
+
compute_node
.
getId
()
+
"/"
+
access_token_id
,
"access_token"
:
"V2/"
+
compute_node
.
getId
()
+
"/"
+
access_token_id
,
"access_token_url"
:
request_url
,
"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
(),
"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