def firmware_update(hosts=None, directory=''):
 ret = {}
 ret.changes = {}
 success = True
 for (host, firmwarefile) in hosts:
  try:
   _firmware_update(firmwarefile, host, directory)
   ret['changes'].update({'host': {'comment': 'Firmware update submitted for {0}'.format(host), 'success': True}})
  except CommandExecutionError as err:
   success = False
   ret['changes'].update({'host': {'comment': 'FAILED to update firmware for {0}'.format(host), 'success': False, 'reason': str(err)}})
 ret['result'] = success
 return ret

def firmware_update ( hosts = None , directory = '' ) : ret = { } ret . changes = { } success = True for ( host , firmwarefile ) in hosts : try : _firmware_update ( firmwarefile , host , directory ) ret [ 'changes' ] . update ( { 'host' : { 'comment' : 'Firmware update submitted for {0}' . format ( host ) , 'success' : True } } ) except CommandExecutionError as err : success = False ret [ 'changes' ] . update ( { 'host' : { 'comment' : 'FAILED to update firmware for {0}' . format ( host ) , 'success' : False , 'reason' : str ( err ) } } ) ret [ 'result' ] = success return ret
state to update the firmware on host using the racadm command firmwarefile filename starting with salt:// host string representing the hostname supplied to the racadm command directory directory name where firmwarefile will be downloaded .