1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 18:21:12 +03:00

AC-567 Remove source_tags from API/UI. Modify EC2 inventory to not return instance ID groups.

This commit is contained in:
Chris Church 2013-10-23 22:46:04 -04:00
parent 04824c8477
commit 27ad680f4d
6 changed files with 10 additions and 22 deletions

View File

@ -686,6 +686,7 @@ class InventorySource(PrimordialModel):
blank=True,
default='',
)
# FIXME: Remove tags field when making other migrations for credential changes!
source_tags = models.CharField(
max_length=1024,
blank=True,

View File

@ -672,9 +672,9 @@ class InventorySourceSerializer(BaseSerializer):
fields = ('id', 'url', 'related', 'summary_fields', 'created',
'modified', 'inventory', 'group', 'source', 'source_path',
'source_vars', 'source_username', 'source_password',
'source_regions', 'source_tags', 'overwrite',
'overwrite_vars', 'update_on_launch', 'update_interval',
'last_update_failed', 'status', 'last_updated')
'source_regions', 'overwrite', 'overwrite_vars',
'update_on_launch', 'update_interval', 'last_update_failed',
'status', 'last_updated')
read_only_fields = ('inventory', 'group')
def to_native(self, obj):
@ -764,10 +764,6 @@ class InventorySourceSerializer(BaseSerializer):
# FIXME
return attrs
def validate_source_tags(self, attrs, source):
# FIXME
return attrs
class InventoryUpdateSerializer(BaseSerializer):
class Meta:

View File

@ -5,6 +5,7 @@
import datetime
import json
import os
import re
# Django
from django.conf import settings
@ -1021,6 +1022,9 @@ class InventoryUpdatesTest(BaseTransactionTest):
source_pks = group.inventory_sources.values_list('pk', flat=True)
self.assertTrue(inventory_source.pk in source_pks)
self.assertTrue(group.has_inventory_sources)
# Make sure EC2 instance ID groups are excluded.
self.assertFalse(re.match(r'^i-[0-9a-f]{8}$', group.name, re.I),
group.name)
def test_update_from_ec2(self):
source_username = getattr(settings, 'TEST_AWS_ACCESS_KEY_ID', '')

View File

@ -336,8 +336,9 @@ class Ec2Inventory(object):
# Add to index
self.index[dest] = [region, instance.id]
# For AWX: do not output group based on instance ID!!!
# Inventory: Group by instance ID (always a group of 1)
self.inventory[instance.id] = [dest]
# self.inventory[instance.id] = [dest]
# Inventory: Group by region
self.push(self.inventory, region, dest)

View File

@ -155,19 +155,6 @@ angular.module('GroupFormDefinition', [])
"Only hosts associated with the list of regions will be included in the update process.</p>",
dataContainer: 'body'
},
source_tags: {
label: 'Tags',
excludeModal: true,
type: 'text',
ngShow: "source.value == 'ec2'",
addRequired: false,
editRequired: false,
dataTitle: 'Source Regions',
dataPlacement: 'left',
awPopOver: "<p>Comma separated list of tags. Tag names must match those defined at the inventory source." +
" Only hosts associated with the list of tags will be included in the update process.</p>",
dataContainer: 'body'
},
source_vars: {
label: 'Source Variables',
ngShow: "source.value == 'file' || source.value == 'ec2'",

View File

@ -810,7 +810,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
source_username: scope['source_username'],
source_password: scope['source_password'],
source_regions: scope['source_regions'],
source_tags: scope['source_tags'],
overwrite: scope['overwrite'],
overwrite_vars: scope['overwrite_vars'],
update_on_launch: scope['update_on_launch'],