Commit ef150497 authored by Rafael Monnerat's avatar Rafael Monnerat

Define REST API for software release

parent c044d7bc
...@@ -97,19 +97,14 @@ def setComputerPartitionConnectionJson(computer_id, computer_partition_id): ...@@ -97,19 +97,14 @@ def setComputerPartitionConnectionJson(computer_id, computer_partition_id):
execute_db('partition', query, argument_list) execute_db('partition', query, argument_list)
return 'done' return 'done'
@app.route('/buildingSoftwareRelease', methods=['POST']) @app.route('/<computer_id>/software/building', methods=['POST'])
def buildingSoftwareRelease(): @app.route('/<computer_id>/software/available', methods=['POST'])
return 'Ignored' def software_release_ignored_api(computer_id):
@app.route('/availableSoftwareRelease', methods=['POST'])
def availableSoftwareRelease():
computer_id = request.form['computer_id']
url = request.form['url'] url = request.form['url']
return 'Ignored' return 'Ignored'
@app.route('/softwareReleaseError', methods=['POST']) @app.route('/<computer_id>/software/error', methods=['POST'])
def softwareReleaseError(): def softwareReleaseError(computer_id):
return 'Ignored'
@app.route('/<computer_id>/partition/<computer_partition_id>/building', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/building', methods=['POST'])
def buildingComputerPartition(computer_id, computer_partition_id): def buildingComputerPartition(computer_id, computer_partition_id):
......
...@@ -107,23 +107,23 @@ class SoftwareRelease(SlapDocument): ...@@ -107,23 +107,23 @@ class SoftwareRelease(SlapDocument):
def error(self, error_log): def error(self, error_log):
# Does not follow interface # Does not follow interface
self._connection_helper.POST('/softwareReleaseError', { url = '%s/software/error' % self._computer_guid,
self._connection_helper.POST(url, {
'url': self._software_release, 'url': self._software_release,
'computer_id' : self._computer_guid,
'error_log': error_log}) 'error_log': error_log})
def getURI(self): def getURI(self):
return self._software_release return self._software_release
def available(self): def available(self):
self._connection_helper.POST('/availableSoftwareRelease', { url = '%s/software/available' % self._computer_guid
'url': self._software_release, self._connection_helper.POST(url, {
'computer_id': self._computer_guid}) 'url': self._software_release})
def building(self): def building(self):
self._connection_helper.POST('/buildingSoftwareRelease', { url = '%s/software/building' % self._computer_guid
'url': self._software_release, self._connection_helper.POST(url, {
'computer_id': self._computer_guid}) 'url': self._software_release})
"""Exposed exceptions""" """Exposed exceptions"""
# XXX Why do we need to expose exceptions? # XXX Why do we need to expose exceptions?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment