Permalink
Browse files

Fix ignored allocation in dtrs lookup

  • Loading branch information...
1 parent bd0fcd9 commit fee2a20563b847c7ee4c3c95195c4d90e0456274 @oldpatricka oldpatricka committed Mar 22, 2013
Showing with 8 additions and 2 deletions.
  1. +5 −1 epu/dtrs/core.py
  2. +3 −1 epu/dtrs/test/test_dtrs.py
View
@@ -49,7 +49,7 @@ def lookup(self, caller, dt_name, dtrs_request_node, vars):
# dtrs_request_node contains:
# - instance count (assuming one for now)
# - site
- # - allocation (ignored for now)
+ # - allocation
try:
site = dtrs_request_node['site']
except KeyError:
@@ -71,6 +71,10 @@ def lookup(self, caller, dt_name, dtrs_request_node, vars):
except KeyError:
raise DeployableTypeLookupError('iaas_allocation missing in mappings of DT %s and site %s', dt_name, site)
+ allocation = dtrs_request_node.get("allocation")
+ if allocation is not None:
+ iaas_allocation = allocation
+
site_credentials = self.store.describe_credentials(caller, site)
if not site_credentials:
raise DeployableTypeLookupError('Credentials missing for caller %s and site %s', caller, site)
@@ -65,10 +65,12 @@ def test_dtrs_lookup(self):
}
self.dtrs.add_dt(self.caller, "base-cluster-1", dt_definition)
- req_node = {'site': 'nimbus-test'}
+ allocation_override = "m1.xlarge"
+ req_node = {'site': 'nimbus-test', 'allocation': allocation_override}
result = self.dtrs_client.lookup(self.caller, 'base-cluster-1', req_node)
node = result['node']
self.assertTrue('iaas_image' in node)
+ self.assertEqual(node['iaas_allocation'], allocation_override)
try:
self.dtrs_client.lookup(self.caller, 'this-dt-doesnt-exist', node)

0 comments on commit fee2a20

Please sign in to comment.