Commit 61b8f6f3 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

slapos_cloud: Catch not found computer when getting compute partition

parent 7ca3a9b7
...@@ -71,9 +71,13 @@ class SlapOSCatalogToolCacheMixin(object): ...@@ -71,9 +71,13 @@ class SlapOSCatalogToolCacheMixin(object):
@UnrestrictedMethod @UnrestrictedMethod
def _getNonCachedComputeNodeUid(self, reference): def _getNonCachedComputeNodeUid(self, reference):
return self.unrestrictedSearchResults( compute_node_list = self.unrestrictedSearchResults(
portal_type=['Compute Node', 'Remote Node'], reference=reference, portal_type=['Compute Node', 'Remote Node'],
validation_state="validated")[0].UID reference=reference,
validation_state="validated")
if len(compute_node_list) != 1:
raise NotFound, "No document found with parameters: %s" % reference
return compute_node_list[0].UID
def getComputePartitionObject(self, compute_node_reference, def getComputePartitionObject(self, compute_node_reference,
compute_partition_reference): compute_partition_reference):
...@@ -115,4 +119,4 @@ class SlapOSCatalogToolCacheMixin(object): ...@@ -115,4 +119,4 @@ class SlapOSCatalogToolCacheMixin(object):
result = CachingMethod(self._getNonCachedSoftwareInstance, result = CachingMethod(self._getNonCachedSoftwareInstance,
id='_getSoftwareInstanceObject', id='_getSoftwareInstanceObject',
cache_factory='slap_cache_factory')(reference, include_shared=include_shared) cache_factory='slap_cache_factory')(reference, include_shared=include_shared)
return self.getPortalObject().restrictedTraverse(result) return self.getPortalObject().restrictedTraverse(result)
\ No newline at end of file
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