Remove insights_credential from inventory

This commit is contained in:
Bill Nottingham
2021-06-16 16:47:42 -04:00
committed by Shane McDonald
parent 0947d30682
commit 1e68519c99
26 changed files with 38 additions and 267 deletions

View File

@@ -57,10 +57,6 @@ options:
description:
- The host_filter field. Only useful when C(kind=smart).
type: str
insights_credential:
description:
- Credentials to be used by hosts belonging to this inventory when accessing Red Hat Insights API.
type: str
instance_groups:
description:
- list of Instance Groups for this Organization to run on.
@@ -110,7 +106,6 @@ def main():
kind=dict(choices=['', 'smart'], default=''),
host_filter=dict(),
instance_groups=dict(type="list", elements='str'),
insights_credential=dict(),
state=dict(choices=['present', 'absent'], default='present'),
)
@@ -126,7 +121,6 @@ def main():
state = module.params.get('state')
kind = module.params.get('kind')
host_filter = module.params.get('host_filter')
insights_credential = module.params.get('insights_credential')
# Attempt to look up the related items the user specified (these will fail the module if not found)
org_id = module.resolve_name_to_id('organizations', organization)
@@ -161,8 +155,6 @@ def main():
inventory_fields['description'] = description
if variables is not None:
inventory_fields['variables'] = json.dumps(variables)
if insights_credential is not None:
inventory_fields['insights_credential'] = module.resolve_name_to_id('credentials', insights_credential)
association_fields = {}

View File

@@ -5,11 +5,10 @@ __metaclass__ = type
import pytest
from awx.main.models import Inventory, Credential
from awx.main.tests.functional.conftest import insights_credential, credentialtype_insights
@pytest.mark.django_db
def test_inventory_create(run_module, admin_user, organization, insights_credential):
def test_inventory_create(run_module, admin_user, organization):
# Create an insights credential
result = run_module(
@@ -18,7 +17,6 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent
'name': 'foo-inventory',
'organization': organization.name,
'variables': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}},
'insights_credential': insights_credential.name,
'state': 'present',
},
admin_user,
@@ -27,7 +25,6 @@ def test_inventory_create(run_module, admin_user, organization, insights_credent
inv = Inventory.objects.get(name='foo-inventory')
assert inv.variables == '{"foo": "bar", "another-foo": {"barz": "bar2"}}'
assert inv.insights_credential.name == insights_credential.name
result.pop('module_args', None)
result.pop('invocation', None)

View File

@@ -41,7 +41,6 @@
inventory:
name: "{{ inv_name1 }}"
organization: Default
insights_credential: "{{ result.id }}"
instance_groups:
- "{{ group_name1 }}"
state: present
@@ -55,7 +54,6 @@
inventory:
name: "{{ result.id }}"
organization: Default
insights_credential: "{{ cred_name1 }}"
state: present
register: result