From: Faiyaz Ahmed Date: Fri, 14 Mar 2008 03:08:43 +0000 (+0000) Subject: use Notify API function X-Git-Tag: BootManager-3.2-5~10 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ef3482ee319e2b7019acac8711bd037e4cb320b2;p=bootmanager.git use Notify API function --- diff --git a/source/steps/CheckHardwareRequirements.py b/source/steps/CheckHardwareRequirements.py index 43caa43..a262860 100644 --- a/source/steps/CheckHardwareRequirements.py +++ b/source/steps/CheckHardwareRequirements.py @@ -87,9 +87,7 @@ def Run( vars, log ): log.write( "Insufficient memory to run node: %s kb\n" % total_mem ) log.write( "Required memory: %s kb\n" % MINIMUM_MEMORY ) - include_pis= 0 - include_techs= 1 - include_support= 0 + techs=[] sent= 0 try: @@ -98,12 +96,17 @@ def Run( vars, log ): # include_pis, # include_techs, # include_support) ) + params = {"hostname" : vars['hostname'] + vars['domainname']} person_ids = BootAPI.call_api_function( vars, "GetSites", + (vars['SITE_ID'], ['person_ids']))[0] + persons = BootAPI.call_api_function( vars, "GetPersons", + (person_ids, ['person_id', 'roles'])) + for person in persons: + if "tech" in person['roles']: techs.append(person['person_id']) + msg = BootAPI.call_api_function( vars, "GetMessages", + ({"message_id": notify_messages.MSG_INSUFFICIENT_MEMORY}),)[0] sent= BootAPI.call_api_function( vars, "NotifyPersons", - (notify_messages.MSG_INSUFFICIENT_MEMORY, - include_pis, - include_techs, - include_support) ) + (techs, msg['subject'] % params, msg['body'] % params)) except BootManagerException, e: log.write( "Call to NotifyPersons failed: %s.\n" % e )