slaplib: Raise human readable message when impossible to supply.

parent 3c4ebec6
......@@ -168,12 +168,14 @@ class Supply(SlapDocument):
zope.interface.implements(interface.ISupply)
def supply(self, software_release, computer_guid=None, state='available'):
# Note: Zope accepts additional arguments, so state in case of older
# servers will be just ignored.
self._connection_helper.POST('/supplySupply', {
'url': software_release,
'computer_id': computer_guid,
'state': state})
try:
self._connection_helper.POST('/supplySupply', {
'url': software_release,
'computer_id': computer_guid,
'state': state})
except NotFoundError:
raise NotFoundError("Computer %s has not been found by SlapOS Master."
% computer_guid)
class OpenOrder(SlapDocument):
......
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