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
Ivan Tyagov
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():
...
@@ -111,41 +111,29 @@ def availableSoftwareRelease():
def
softwareReleaseError
():
def
softwareReleaseError
():
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/buildingComputerPartition'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/building'
,
methods
=
[
'POST'
])
def
buildingComputerPartition
():
def
buildingComputerPartition
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/availableComputerPartition'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/available'
,
methods
=
[
'POST'
])
def
availableComputerPartition
():
def
availableComputerPartition
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/softwareInstanceError'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/error'
,
methods
=
[
'POST'
])
def
softwareInstanceError
():
def
softwareInstanceError
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
error_log
=
request
.
form
[
'error_log'
]
error_log
=
request
.
form
[
'error_log'
]
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/startedComputerPartition'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/started'
,
methods
=
[
'POST'
])
def
startedComputerPartition
():
def
startedComputerPartition
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/stoppedComputerPartition'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/stopped'
,
methods
=
[
'POST'
])
def
stoppedComputerPartition
():
def
stoppedComputerPartition
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
return
'Ignored'
return
'Ignored'
@
app
.
route
(
'/destroyedComputerPartition'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>/destroyed'
,
methods
=
[
'POST'
])
def
destroyedComputerPartition
():
def
destroyedComputerPartition
(
computer_id
,
computer_partition_id
):
computer_id
=
request
.
form
[
'computer_id'
]
computer_partition_id
=
request
.
form
[
'computer_partition_id'
]
return
'Ignored'
return
'Ignored'
#@app.route('/partition/<partition_reference>', methods=['PUT'])
#@app.route('/partition/<partition_reference>', methods=['PUT'])
...
@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''):
...
@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''):
filter_json
=
request
.
form
.
get
(
'filter_json'
)
filter_json
=
request
.
form
.
get
(
'filter_json'
)
raise
NotImplementedError
raise
NotImplementedError
@
app
.
route
(
'/useComputer'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/<computer_id>/usage'
,
methods
=
[
'POST'
])
def
useComputer
():
def
useComputer
(
computer_id
):
computer_id
=
request
.
form
[
'computer_id'
]
use_string
=
request
.
form
[
'use_string'
]
use_string
=
request
.
form
[
'use_string'
]
return
'Ignored'
return
'Ignored'
...
...
slapos/slap/slap.py
View file @
a5b888e1
...
@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument):
...
@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument):
'computer_partition_id'
:
self
.
_partition_id
})
'computer_partition_id'
:
self
.
_partition_id
})
def
available
(
self
):
def
available
(
self
):
self
.
_connection_helper
.
POST
(
'/availableComputerPartition'
,
{
url
=
"/%s/partition/%s/available"
%
(
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
self
.
_partition_id
)
'computer_partition_id'
:
self
.
_partition_id
}
)
self
.
_connection_helper
.
POST
(
url
)
def
destroyed
(
self
):
def
destroyed
(
self
):
self
.
_connection_helper
.
POST
(
'/destroyedComputerPartition'
,
{
url
=
"/%s/partition/%s/destroyed"
%
(
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
self
.
_partition_id
)
'computer_partition_id'
:
self
.
_partition_id
,
self
.
_connection_helper
.
POST
(
url
)
})
def
started
(
self
):
def
started
(
self
):
self
.
_connection_helper
.
POST
(
'/startedComputerPartition'
,
{
url
=
"/%s/partition/%s/started"
%
(
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
self
.
_partition_id
)
'computer_partition_id'
:
self
.
_partition_id
,
self
.
_connection_helper
.
POST
(
url
)
})
def
stopped
(
self
):
def
stopped
(
self
):
self
.
_connection_helper
.
POST
(
'/stoppedComputerPartition'
,
{
url
=
"/%s/partition/%s/stopped"
%
(
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
self
.
_partition_id
)
'computer_partition_id'
:
self
.
_partition_id
,
self
.
_connection_helper
.
POST
(
url
)
})
def
error
(
self
,
error_log
):
def
error
(
self
,
error_log
):
self
.
_connection_helper
.
POST
(
'/softwareInstanceError'
,
{
url
=
"/%s/partition/%s/error"
%
(
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
self
.
_partition_id
)
'computer_partition_id'
:
self
.
_partition_id
,
self
.
_connection_helper
.
POST
(
url
,
{
'error_log'
:
error_log
})
'error_log'
:
error_log
})
def
getId
(
self
):
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