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):
@UnrestrictedMethod
def _getNonCachedComputeNodeUid(self, reference):
return self.unrestrictedSearchResults(
portal_type=['Compute Node', 'Remote Node'], reference=reference,
validation_state="validated")[0].UID
compute_node_list = self.unrestrictedSearchResults(
portal_type=['Compute Node', 'Remote Node'],
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,
compute_partition_reference):
......@@ -115,4 +119,4 @@ class SlapOSCatalogToolCacheMixin(object):
result = CachingMethod(self._getNonCachedSoftwareInstance,
id='_getSoftwareInstanceObject',
cache_factory='slap_cache_factory')(reference, include_shared=include_shared)
return self.getPortalObject().restrictedTraverse(result)
\ No newline at end of file
return self.getPortalObject().restrictedTraverse(result)
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