def min_party(name, zk_hosts, min_nodes, blocking=False):
 ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
 if __opts__['test']:
  ret['result'] = None
  ret['comment'] = 'Attempt to ensure min_party'
  return ret
 nodes = __salt__['zk_concurrency.party_members'](name, zk_hosts, min_nodes, blocking=blocking)
 if (not isinstance(nodes, list)):
  raise Exception('Error from zk_concurrency.party_members, return was not a list: {0}'.format(nodes))
 num_nodes = len(nodes)
 if ((num_nodes >= min_nodes) or blocking):
  ret['result'] = (None if __opts__['test'] else True)
  if (not blocking):
   ret['comment'] = 'Currently {0} nodes, which is >= {1}'.format(num_nodes, min_nodes)
  else:
   ret['comment'] = 'Blocked until {0} nodes were available. Unblocked after {1} nodes became available'.format(min_nodes, num_nodes)
 else:
  ret['result'] = False
  ret['comment'] = 'Currently {0} nodes, which is < {1}'.format(num_nodes, min_nodes)
 return ret

def min_party ( name , zk_hosts , min_nodes , blocking = False ) : ret = { 'name' : name , 'changes' : { } , 'result' : False , 'comment' : '' } if __opts__ [ 'test' ] : ret [ 'result' ] = None ret [ 'comment' ] = 'Attempt to ensure min_party' return ret nodes = __salt__ [ 'zk_concurrency.party_members' ] ( name , zk_hosts , min_nodes , blocking = blocking ) if ( not isinstance ( nodes , list ) ) : raise Exception ( 'Error from zk_concurrency.party_members, return was not a list: {0}' . format ( nodes ) ) num_nodes = len ( nodes ) if ( ( num_nodes >= min_nodes ) or blocking ) : ret [ 'result' ] = ( None if __opts__ [ 'test' ] else True ) if ( not blocking ) : ret [ 'comment' ] = 'Currently {0} nodes, which is >= {1}' . format ( num_nodes , min_nodes ) else : ret [ 'comment' ] = 'Blocked until {0} nodes were available. Unblocked after {1} nodes became available' . format ( min_nodes , num_nodes ) else : ret [ 'result' ] = False ret [ 'comment' ] = 'Currently {0} nodes, which is < {1}' . format ( num_nodes , min_nodes ) return ret
ensure that there are min_nodes in the party at name .