mirror of
https://github.com/ansible/awx.git
synced 2026-07-29 08:59:55 -02:30
remove deprecated legacy manual inventory source support
see: https://github.com/ansible/awx/issues/6309
This commit is contained in:
@@ -972,7 +972,7 @@ def test_field_removal(put, organization, admin, credentialtype_ssh):
|
||||
['insights_inventories', Inventory()],
|
||||
['unifiedjobs', Job()],
|
||||
['unifiedjobtemplates', JobTemplate()],
|
||||
['unifiedjobtemplates', InventorySource()],
|
||||
['unifiedjobtemplates', InventorySource(source='ec2')],
|
||||
['projects', Project()],
|
||||
['workflowjobnodes', WorkflowJobNode()],
|
||||
])
|
||||
|
||||
@@ -23,9 +23,9 @@ def _mk_project_update():
|
||||
|
||||
|
||||
def _mk_inventory_update():
|
||||
source = InventorySource()
|
||||
source = InventorySource(source='ec2')
|
||||
source.save()
|
||||
iu = InventoryUpdate(inventory_source=source)
|
||||
iu = InventoryUpdate(inventory_source=source, source='e2')
|
||||
return iu
|
||||
|
||||
|
||||
|
||||
@@ -123,7 +123,11 @@ def test_delete_project_update_in_active_state(project, delete, admin, status):
|
||||
@pytest.mark.parametrize("status", list(TEST_STATES))
|
||||
@pytest.mark.django_db
|
||||
def test_delete_inventory_update_in_active_state(inventory_source, delete, admin, status):
|
||||
i = InventoryUpdate.objects.create(inventory_source=inventory_source, status=status)
|
||||
i = InventoryUpdate.objects.create(
|
||||
inventory_source=inventory_source,
|
||||
status=status,
|
||||
source=inventory_source.source
|
||||
)
|
||||
url = reverse('api:inventory_update_detail', kwargs={'pk': i.pk})
|
||||
delete(url, None, admin, expect=403)
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ class TestINIImports:
|
||||
assert inventory.hosts.count() == 1 # baseline worked
|
||||
|
||||
inv_src2 = inventory.inventory_sources.create(
|
||||
name='bar', overwrite=True
|
||||
name='bar', overwrite=True, source='ec2'
|
||||
)
|
||||
os.environ['INVENTORY_SOURCE_ID'] = str(inv_src2.pk)
|
||||
os.environ['INVENTORY_UPDATE_ID'] = str(inv_src2.create_unified_job().pk)
|
||||
|
||||
@@ -568,7 +568,10 @@ def inventory_source_factory(inventory_factory):
|
||||
|
||||
@pytest.fixture
|
||||
def inventory_update(inventory_source):
|
||||
return InventoryUpdate.objects.create(inventory_source=inventory_source)
|
||||
return InventoryUpdate.objects.create(
|
||||
inventory_source=inventory_source,
|
||||
source=inventory_source.source
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -197,9 +197,10 @@ class TestRelatedJobs:
|
||||
assert job.id in [jerb.id for jerb in group._get_related_jobs()]
|
||||
|
||||
def test_related_group_update(self, group):
|
||||
src = group.inventory_sources.create(name='foo')
|
||||
src = group.inventory_sources.create(name='foo', source='ec2')
|
||||
job = InventoryUpdate.objects.create(
|
||||
inventory_source=src
|
||||
inventory_source=src,
|
||||
source=src.source
|
||||
)
|
||||
assert job.id in [jerb.id for jerb in group._get_related_jobs()]
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ class TestJobNotificationMixin(object):
|
||||
kwargs = {}
|
||||
if JobClass is InventoryUpdate:
|
||||
kwargs['inventory_source'] = inventory_source
|
||||
kwargs['source'] = inventory_source.source
|
||||
elif JobClass is ProjectUpdate:
|
||||
kwargs['project'] = project
|
||||
|
||||
|
||||
@@ -297,7 +297,10 @@ class TestInstanceGroupOrdering:
|
||||
assert ad_hoc.preferred_instance_groups == [ig_inv, ig_org]
|
||||
|
||||
def test_inventory_update_instance_groups(self, instance_group_factory, inventory_source, default_instance_group):
|
||||
iu = InventoryUpdate.objects.create(inventory_source=inventory_source)
|
||||
iu = InventoryUpdate.objects.create(
|
||||
inventory_source=inventory_source,
|
||||
source=inventory_source.source
|
||||
)
|
||||
assert iu.preferred_instance_groups == [default_instance_group]
|
||||
ig_org = instance_group_factory("OrgIstGrp", [default_instance_group.instances.first()])
|
||||
ig_inv = instance_group_factory("InvIstGrp", [default_instance_group.instances.first()])
|
||||
|
||||
@@ -186,7 +186,11 @@ def test_group(get, admin_user):
|
||||
def test_inventory_source(get, admin_user):
|
||||
test_org = Organization.objects.create(name='test_org')
|
||||
test_inv = Inventory.objects.create(name='test_inv', organization=test_org)
|
||||
test_source = InventorySource.objects.create(name='test_source', inventory=test_inv)
|
||||
test_source = InventorySource.objects.create(
|
||||
name='test_source',
|
||||
inventory=test_inv,
|
||||
source='ec2'
|
||||
)
|
||||
url = reverse('api:inventory_source_detail', kwargs={'pk': test_source.pk})
|
||||
response = get(url, user=admin_user, expect=200)
|
||||
assert response.data['related']['named_url'].endswith('/test_source++test_inv++test_org/')
|
||||
|
||||
@@ -90,7 +90,7 @@ def test_inherited_notification_templates(get, post, user, organization, project
|
||||
notification_templates.append(response.data['id'])
|
||||
i = Inventory.objects.create(name='test', organization=organization)
|
||||
i.save()
|
||||
isrc = InventorySource.objects.create(name='test', inventory=i)
|
||||
isrc = InventorySource.objects.create(name='test', inventory=i, source='ec2')
|
||||
isrc.save()
|
||||
jt = JobTemplate.objects.create(name='test', inventory=i, project=project, playbook='debug.yml')
|
||||
jt.save()
|
||||
|
||||
@@ -24,7 +24,11 @@ def test_implied_organization_subquery_inventory():
|
||||
inventory = Inventory.objects.create(name='foo{}'.format(i))
|
||||
else:
|
||||
inventory = Inventory.objects.create(name='foo{}'.format(i), organization=org)
|
||||
inv_src = InventorySource.objects.create(name='foo{}'.format(i), inventory=inventory)
|
||||
inv_src = InventorySource.objects.create(
|
||||
name='foo{}'.format(i),
|
||||
inventory=inventory,
|
||||
source='ec2'
|
||||
)
|
||||
sources = UnifiedJobTemplate.objects.annotate(
|
||||
test_field=rbac.implicit_org_subquery(UnifiedJobTemplate, InventorySource)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user