mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 11:57:37 -02:30
Add splitted up inventory source plugins (#15584)
* Add splitted up inventory source plugins
Fix CI failure introduced by
7d83b7dfdb
This commit is contained in:
@@ -14,7 +14,25 @@ __all__ = [
|
|||||||
'STANDARD_INVENTORY_UPDATE_ENV',
|
'STANDARD_INVENTORY_UPDATE_ENV',
|
||||||
]
|
]
|
||||||
|
|
||||||
CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'controller', 'insights', 'terraform', 'openshift_virtualization')
|
CLOUD_PROVIDERS = (
|
||||||
|
'azure_rm',
|
||||||
|
'ec2',
|
||||||
|
'gce',
|
||||||
|
'vmware',
|
||||||
|
'openstack',
|
||||||
|
'rhv',
|
||||||
|
'satellite6',
|
||||||
|
'controller',
|
||||||
|
'insights',
|
||||||
|
'terraform',
|
||||||
|
'openshift_virtualization',
|
||||||
|
'controller_supported',
|
||||||
|
'rhv_supported',
|
||||||
|
'openshift_virtualization_supported',
|
||||||
|
'insights_supported',
|
||||||
|
'satellite6_supported',
|
||||||
|
)
|
||||||
|
|
||||||
PRIVILEGE_ESCALATION_METHODS = [
|
PRIVILEGE_ESCALATION_METHODS = [
|
||||||
('sudo', _('Sudo')),
|
('sudo', _('Sudo')),
|
||||||
('su', _('Su')),
|
('su', _('Su')),
|
||||||
|
|||||||
@@ -1062,7 +1062,10 @@ class InventorySourceOptions(BaseModel):
|
|||||||
credential = None
|
credential = None
|
||||||
for cred in self.credentials.all():
|
for cred in self.credentials.all():
|
||||||
if self.source in CLOUD_PROVIDERS:
|
if self.source in CLOUD_PROVIDERS:
|
||||||
if cred.kind == self.source.replace('ec2', 'aws'):
|
source = self.source.replace('ec2', 'aws')
|
||||||
|
if source.endswith('_supported'):
|
||||||
|
source = source[:-10]
|
||||||
|
if cred.kind == source:
|
||||||
credential = cred
|
credential = cred
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ def credential_kind(source):
|
|||||||
"""Given the inventory source kind, return expected credential kind"""
|
"""Given the inventory source kind, return expected credential kind"""
|
||||||
if source == 'openshift_virtualization':
|
if source == 'openshift_virtualization':
|
||||||
return 'kubernetes_bearer_token'
|
return 'kubernetes_bearer_token'
|
||||||
|
|
||||||
return source.replace('ec2', 'aws')
|
return source.replace('ec2', 'aws')
|
||||||
|
|
||||||
|
|
||||||
@@ -194,6 +195,9 @@ def create_reference_data(source_dir, env, content):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@pytest.mark.parametrize('this_kind', CLOUD_PROVIDERS)
|
@pytest.mark.parametrize('this_kind', CLOUD_PROVIDERS)
|
||||||
def test_inventory_update_injected_content(this_kind, inventory, fake_credential_factory, mock_me):
|
def test_inventory_update_injected_content(this_kind, inventory, fake_credential_factory, mock_me):
|
||||||
|
if this_kind.endswith('_supported'):
|
||||||
|
this_kind = this_kind[:-10]
|
||||||
|
|
||||||
ExecutionEnvironment.objects.create(name='Control Plane EE', managed=True)
|
ExecutionEnvironment.objects.create(name='Control Plane EE', managed=True)
|
||||||
ExecutionEnvironment.objects.create(name='Default Job EE', managed=False)
|
ExecutionEnvironment.objects.create(name='Default Job EE', managed=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user