def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile):
 tmp = copy.deepcopy(__salt__['config.option'](alarms_from_pillar, {}))
 if alarms:
  tmp = dictupdate.update(tmp, alarms)
 merged_return_value = {'name': name, 'result': True, 'comment': '', 'changes': {}}
 for (_, info) in six.iteritems(tmp):
  info['name'] = ((name + ' ') + info['name'])
  info['attributes']['description'] = ((name + ' ') + info['attributes']['description'])
  if ('dimensions' not in info['attributes']):
   info['attributes']['dimensions'] = {'AutoScalingGroupName': [name]}
  scaling_policy_actions_only = True
  for action_type in ['alarm_actions', 'insufficient_data_actions', 'ok_actions']:
   if (action_type in info['attributes']):
    new_actions = []
    for action in info['attributes'][action_type]:
     if ('scaling_policy' not in action):
      scaling_policy_actions_only = False
     if (':self:' in action):
      action = action.replace(':self:', ':{0}:'.format(name))
     new_actions.append(action)
    info['attributes'][action_type] = new_actions
  if (scaling_policy_actions_only and min_size_equals_max_size):
   continue
  kwargs = {'name': info['name'], 'attributes': info['attributes'], 'region': region, 'key': key, 'keyid': keyid, 'profile': profile}
  results = __states__['boto_cloudwatch_alarm.present'](**kwargs)
  if (not results['result']):
   merged_return_value['result'] = False
  if (results.get('changes', {}) != {}):
   merged_return_value['changes'][info['name']] = results['changes']
  if ('comment' in results):
   merged_return_value['comment'] += results['comment']
 return merged_return_value

def _alarms_present ( name , min_size_equals_max_size , alarms , alarms_from_pillar , region , key , keyid , profile ) : tmp = copy . deepcopy ( __salt__ [ 'config.option' ] ( alarms_from_pillar , { } ) ) if alarms : tmp = dictupdate . update ( tmp , alarms ) merged_return_value = { 'name' : name , 'result' : True , 'comment' : '' , 'changes' : { } } for ( _ , info ) in six . iteritems ( tmp ) : info [ 'name' ] = ( ( name + ' ' ) + info [ 'name' ] ) info [ 'attributes' ] [ 'description' ] = ( ( name + ' ' ) + info [ 'attributes' ] [ 'description' ] ) if ( 'dimensions' not in info [ 'attributes' ] ) : info [ 'attributes' ] [ 'dimensions' ] = { 'AutoScalingGroupName' : [ name ] } scaling_policy_actions_only = True for action_type in [ 'alarm_actions' , 'insufficient_data_actions' , 'ok_actions' ] : if ( action_type in info [ 'attributes' ] ) : new_actions = [ ] for action in info [ 'attributes' ] [ action_type ] : if ( 'scaling_policy' not in action ) : scaling_policy_actions_only = False if ( ':self:' in action ) : action = action . replace ( ':self:' , ':{0}:' . format ( name ) ) new_actions . append ( action ) info [ 'attributes' ] [ action_type ] = new_actions if ( scaling_policy_actions_only and min_size_equals_max_size ) : continue kwargs = { 'name' : info [ 'name' ] , 'attributes' : info [ 'attributes' ] , 'region' : region , 'key' : key , 'keyid' : keyid , 'profile' : profile } results = __states__ [ 'boto_cloudwatch_alarm.present' ] ( ** kwargs ) if ( not results [ 'result' ] ) : merged_return_value [ 'result' ] = False if ( results . get ( 'changes' , { } ) != { } ) : merged_return_value [ 'changes' ] [ info [ 'name' ] ] = results [ 'changes' ] if ( 'comment' in results ) : merged_return_value [ 'comment' ] += results [ 'comment' ] return merged_return_value
helper method for present .