def _bulk_state(saltfunc, lbn, workers, profile):
 ret = {'name': lbn, 'result': True, 'changes': {}, 'comment': ''}
 if (not isinstance(workers, list)):
  ret['result'] = False
  ret['comment'] = 'workers should be a list not a {0}'.format(type(workers))
  return ret
 if __opts__['test']:
  ret['result'] = None
  return ret
 log.info('executing {0} to modjk workers {1}'.format(saltfunc, workers))
 try:
  cmdret = __salt__[saltfunc](workers, lbn, profile=profile)
 except KeyError:
  ret['result'] = False
  ret['comment'] = 'unsupported function {0}'.format(saltfunc)
  return ret
 errors = []
 for (worker, ok) in six.iteritems(cmdret):
  if (not ok):
   errors.append(worker)
 ret['changes'] = {'status': cmdret}
 if errors:
  ret['result'] = False
  ret['comment'] = '{0} failed on some workers'.format(saltfunc)
 return ret

def _bulk_state ( saltfunc , lbn , workers , profile ) : ret = { 'name' : lbn , 'result' : True , 'changes' : { } , 'comment' : '' } if ( not isinstance ( workers , list ) ) : ret [ 'result' ] = False ret [ 'comment' ] = 'workers should be a list not a {0}' . format ( type ( workers ) ) return ret if __opts__ [ 'test' ] : ret [ 'result' ] = None return ret log . info ( 'executing {0} to modjk workers {1}' . format ( saltfunc , workers ) ) try : cmdret = __salt__ [ saltfunc ] ( workers , lbn , profile = profile ) except KeyError : ret [ 'result' ] = False ret [ 'comment' ] = 'unsupported function {0}' . format ( saltfunc ) return ret errors = [ ] for ( worker , ok ) in six . iteritems ( cmdret ) : if ( not ok ) : errors . append ( worker ) ret [ 'changes' ] = { 'status' : cmdret } if errors : ret [ 'result' ] = False ret [ 'comment' ] = '{0} failed on some workers' . format ( saltfunc ) return ret
generic function for bulk worker operation .