Commit 2339a5ef authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Add combine function for multiple BM in template tool

parent eb73e563
...@@ -1637,31 +1637,38 @@ class TemplateTool (BaseTool): ...@@ -1637,31 +1637,38 @@ class TemplateTool (BaseTool):
final_prop_item.install() final_prop_item.install()
security.declareProtected(Permissions.ManagePortal, security.declareProtected(Permissions.ManagePortal,
'installMultipleBusinessManager') 'combineMultipleBusinessManager')
def installMultipleBusinessManager(self, bm_list): def combineMultipleBusinessManager(self, bm_list):
""" """
Creates a single BM from multiple Business Manager and run installation Combines multiple BM to form single flattened BM
on all at once after reducing the final BM.
""" """
# Create the final Business Manager # Create the final Business Manager
if len(bm_list) == 1: if len(bm_list) == 1:
combinedBT = bm_list[0] combinedBM = bm_list[0]
else: else:
# Summation should also consider arithmetic on the Business Item(s) # Summation should also consider arithmetic on the Business Item(s)
# having same path and layer and combine them. # having same path and layer and combine them.
combinedBT = sum(bm_list) combinedBM = sum(bm_list)
# XXX: We are missing the part of creating installed_BM for all the BM # XXX: We are missing the part of creating installed_BM for all the BM
# we have in bm_list, because this would be needed in case we build # we have in bm_list, because this would be needed in case we build
# Business Manager again # Business Manager again
# Reduce the final Business Manager # Reduce the final Business Manager
combinedBT.reduceBusinessManager() combinedBM.reduceBusinessManager()
combinedBT.flattenBusinessManager() combinedBM.flattenBusinessManager()
return combinedBM
if combinedBT.getStatus() == 'flattened': security.declareProtected(Permissions.ManagePortal,
'installMultipleBusinessManager')
def installMultipleBusinessManager(self, bm):
"""
Run installation on flattened Business Manager
"""
if bm.getStatus() == 'flattened':
# Run install on separate Business Item one by one # Run install on separate Business Item one by one
for path_item in combinedBT._path_item_list: for path_item in bm._path_item_list:
path_item.install(self) path_item.install(self)
else: else:
raise ValueError, 'Business Manager not flattened, cannot install' raise ValueError, 'Business Manager not flattened, cannot install'
......
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