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
a5b888e1
Commit
a5b888e1
authored
Jul 12, 2011
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement new REST API.
parent
604b5108
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
45 deletions
+29
-45
slapos/proxy/views.py
slapos/proxy/views.py
+14
-27
slapos/slap/slap.py
slapos/slap/slap.py
+15
-18
No files found.
slapos/proxy/views.py
View file @
a5b888e1
...
...
@@ -111,41 +111,29 @@ def availableSoftwareRelease():
def
softwareReleaseError
():
return
'Ignored'
@
app
.
route
(
'/buildingComputerPartition'
,
methods
=
[
'POST'
])
def
buildingComputerPartition
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/building'
,
methods
=
[
'POST'
])
def
buildingComputerPartition
(
computer_id
,
computer_partition_id
):
return
'Ignored'
@
app
.
route
(
'/availableComputerPartition'
,
methods
=
[
'POST'
])
def
availableComputerPartition
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/available'
,
methods
=
[
'POST'
])
def
availableComputerPartition
(
computer_id
,
computer_partition_id
):
return
'Ignored'
@
app
.
route
(
'/softwareInstanceError'
,
methods
=
[
'POST'
])
def
softwareInstanceError
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/error'
,
methods
=
[
'POST'
])
def
softwareInstanceError
(
computer_id
,
computer_partition_id
):
error_log
=
request
.
form
[
'error_log'
]
return
'Ignored'
@
app
.
route
(
'/startedComputerPartition'
,
methods
=
[
'POST'
])
def
startedComputerPartition
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/started'
,
methods
=
[
'POST'
])
def
startedComputerPartition
(
computer_id
,
computer_partition_id
):
return
'Ignored'
@
app
.
route
(
'/stoppedComputerPartition'
,
methods
=
[
'POST'
])
def
stoppedComputerPartition
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/stopped'
,
methods
=
[
'POST'
])
def
stoppedComputerPartition
(
computer_id
,
computer_partition_id
):
return
'Ignored'
@
app
.
route
(
'/destroyedComputerPartition'
,
methods
=
[
'POST'
])
def
destroyedComputerPartition
():
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/destroyed'
,
methods
=
[
'POST'
])
def
destroyedComputerPartition
(
computer_id
,
computer_partition_id
):
return
'Ignored'
#@app.route('/partition/<partition_reference>', methods=['PUT'])
...
...
@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''):
filter_json
=
request
.
form
.
get
(
'filter_json'
)
raise
NotImplementedError
@
app
.
route
(
'/useComputer'
,
methods
=
[
'POST'
])
def
useComputer
():
computer_id
=
request
.
form
[
'computer_id'
]
@
app
.
route
(
'/<computer_id>/usage'
,
methods
=
[
'POST'
])
def
useComputer
(
computer_id
):
use_string
=
request
.
form
[
'use_string'
]
return
'Ignored'
...
...
slapos/slap/slap.py
View file @
a5b888e1
...
...
@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument):
'computer_partition_id'
:
self
.
_partition_id
})
def
available
(
self
):
self
.
_connection_helper
.
POST
(
'/availableComputerPartition'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
}
)
url
=
"/%s/partition/%s/available"
%
(
self
.
_computer_id
,
self
.
_partition_id
)
self
.
_connection_helper
.
POST
(
url
)
def
destroyed
(
self
):
self
.
_connection_helper
.
POST
(
'/destroyedComputerPartition'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
})
url
=
"/%s/partition/%s/destroyed"
%
(
self
.
_computer_id
,
self
.
_partition_id
)
self
.
_connection_helper
.
POST
(
url
)
def
started
(
self
):
self
.
_connection_helper
.
POST
(
'/startedComputerPartition'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
})
url
=
"/%s/partition/%s/started"
%
(
self
.
_computer_id
,
self
.
_partition_id
)
self
.
_connection_helper
.
POST
(
url
)
def
stopped
(
self
):
self
.
_connection_helper
.
POST
(
'/stoppedComputerPartition'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
})
url
=
"/%s/partition/%s/stopped"
%
(
self
.
_computer_id
,
self
.
_partition_id
)
self
.
_connection_helper
.
POST
(
url
)
def
error
(
self
,
error_log
):
self
.
_connection_helper
.
POST
(
'/softwareInstanceError'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
url
=
"/%s/partition/%s/error"
%
(
self
.
_computer_id
,
self
.
_partition_id
)
self
.
_connection_helper
.
POST
(
url
,
{
'error_log'
:
error_log
})
def
getId
(
self
):
...
...
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