libslap: Raise if partition ID is not defined.

parent 96cb590f
...@@ -409,47 +409,47 @@ class ComputerPartition(SlapDocument): ...@@ -409,47 +409,47 @@ class ComputerPartition(SlapDocument):
def building(self): def building(self):
self._connection_helper.POST('/buildingComputerPartition', { self._connection_helper.POST('/buildingComputerPartition', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id}) 'computer_partition_id': self.getId()})
def available(self): def available(self):
self._connection_helper.POST('/availableComputerPartition', { self._connection_helper.POST('/availableComputerPartition', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id}) 'computer_partition_id': self.getId()})
def destroyed(self): def destroyed(self):
self._connection_helper.POST('/destroyedComputerPartition', { self._connection_helper.POST('/destroyedComputerPartition', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self.getId(),
}) })
def started(self): def started(self):
self._connection_helper.POST('/startedComputerPartition', { self._connection_helper.POST('/startedComputerPartition', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self.getId(),
}) })
def stopped(self): def stopped(self):
self._connection_helper.POST('/stoppedComputerPartition', { self._connection_helper.POST('/stoppedComputerPartition', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self.getId(),
}) })
def error(self, error_log): def error(self, error_log):
self._connection_helper.POST('/softwareInstanceError', { self._connection_helper.POST('/softwareInstanceError', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self.getId(),
'error_log': error_log}) 'error_log': error_log})
def bang(self, message): def bang(self, message):
self._connection_helper.POST('/softwareInstanceBang', { self._connection_helper.POST('/softwareInstanceBang', {
'computer_id': self._computer_id, 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self.getId(),
'message': message}) 'message': message})
def rename(self, new_name, slave_reference=None): def rename(self, new_name, slave_reference=None):
post_dict = dict( post_dict = dict(
computer_id=self._computer_id, computer_id=self._computer_id,
computer_partition_id=self._partition_id, computer_partition_id=self.getId(),
new_name=new_name, new_name=new_name,
) )
if slave_reference is not None: if slave_reference is not None:
...@@ -457,6 +457,8 @@ class ComputerPartition(SlapDocument): ...@@ -457,6 +457,8 @@ class ComputerPartition(SlapDocument):
self._connection_helper.POST('/softwareInstanceRename', post_dict) self._connection_helper.POST('/softwareInstanceRename', post_dict)
def getId(self): def getId(self):
if not self._partition_id:
raise ResourceNotReady()
return self._partition_id return self._partition_id
@_syncComputerPartitionInformation @_syncComputerPartitionInformation
......
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