Add new credential entry point discovery (#15685)

* - add new entry points
- add logic to check what version of the project is running

* remove former discovery method

* update custom_injectors and remove unused import

* fix how  we load external creds

* remove stale code to match devel

* fix cloudforms test and move credential loading

* add load credentials method to get tests passing

* Conditionalize integration tests if the cred is present

* remove inventory source test

* inventory source is covered in the workflow job template target
This commit is contained in:
Jake Jackson
2025-01-15 16:10:28 -05:00
committed by GitHub
parent e106e10b49
commit f05173cb65
12 changed files with 172 additions and 219 deletions

View File

@@ -25,6 +25,21 @@
insights_cred_name2: "AWX-Collection-tests-credential-insights-cred2-{{ test_id }}"
tower_cred_name1: "AWX-Collection-tests-credential-tower-cred1-{{ test_id }}"
- name: Get current Credential Types available
ansible.builtin.set_fact:
credentials: "{{ lookup('awx.awx.controller_api', 'credential_types') }}"
- name: Register Credentials found
set_fact:
aws_found: "{{ 'Amazon Web Services' in credentials | map(attribute='name') | list }}"
vmware_found: "{{ 'VMware vCenter' in credentials | map(attribute='name') | list }}"
azure_found: "{{ 'Microsoft Azure Resource Manager' in credentials | map(attribute='name') | list }}"
gce_found: "{{ 'Google Compute Engine' in credentials | map(attribute='name') | list }}"
insights_found: "{{ 'Red Hat Insights' in credentials | map(attribute='name') | list }}"
satellite_found: "{{ 'Red Hat Satellite 6' in credentials | map(attribute='name') | list }}"
openstack_found: "{{ 'OpenStack' in credentials | map(attribute='name') | list }}"
rhv_found: "{{ 'Red Hat Virtualization' in credentials | map(attribute='name') | list }}"
- name: create a tempdir for an SSH key
local_action: shell mktemp -d
register: tempdir
@@ -464,10 +479,12 @@
password: secret
security_token: aws-token
register: result
when: aws_found
- assert:
that:
- "result is changed"
when: aws_found
- name: Delete an AWS credential
credential:
@@ -476,10 +493,12 @@
state: absent
credential_type: Amazon Web Services
register: result
when: aws_found
- assert:
that:
- "result is changed"
when: aws_found
- name: Create a valid VMWare credential
credential:
@@ -492,10 +511,12 @@
username: joe
password: secret
register: result
when: vmware_found
- assert:
that:
- "result is changed"
when: vmware_found
- name: Delete an VMWare credential
credential:
@@ -504,10 +525,12 @@
state: absent
credential_type: VMware vCenter
register: result
when: vmware_found
- assert:
that:
- "result is changed"
when: vmware_found
- name: Create a valid Satellite6 credential
credential:
@@ -520,10 +543,12 @@
username: joe
password: secret
register: result
when: satellite_found
- assert:
that:
- "result is changed"
when: satellite_found
- name: Delete a Satellite6 credential
credential:
@@ -532,10 +557,12 @@
state: absent
credential_type: Red Hat Satellite 6
register: result
when: satellite_found
- assert:
that:
- "result is changed"
when: satellite_found
- name: Create a valid GCE credential
credential:
@@ -548,10 +575,12 @@
project: ABC123
ssh_key_data: "{{ ssh_key_data }}"
register: result
when: gce_found
- assert:
that:
- "result is changed"
when: gce_found
- name: Delete a GCE credential
credential:
@@ -560,10 +589,12 @@
state: absent
credential_type: Google Compute Engine
register: result
when: gce_found
- assert:
that:
- "result is changed"
when: gce_found
- name: Create a valid AzureRM credential
credential:
@@ -576,10 +607,12 @@
password: secret
subscription: some-subscription
register: result
when: azure_found
- assert:
that:
- "result is changed"
when: azure_found
- name: Create a valid AzureRM credential with a tenant
credential:
@@ -593,10 +626,12 @@
tenant: some-tenant
subscription: some-subscription
register: result
when: azure_found
- assert:
that:
- "result is changed"
when: azure_found
- name: Delete an AzureRM credential
credential:
@@ -605,10 +640,12 @@
state: absent
credential_type: Microsoft Azure Resource Manager
register: result
when: azure_found
- assert:
that:
- "result is changed"
when: azure_found
- name: Create a valid OpenStack credential
credential:
@@ -623,10 +660,12 @@
project: tenant123
domain: some-domain
register: result
when: openstack_found
- assert:
that:
- "result is changed"
when: openstack_found
- name: Delete a OpenStack credential
credential:
@@ -635,10 +674,12 @@
state: absent
credential_type: OpenStack
register: result
when: openstack_found
- assert:
that:
- "result is changed"
when: openstack_found
- name: Create a valid RHV credential
credential:
@@ -651,10 +692,12 @@
username: joe
password: secret
register: result
when: rhv_found
- assert:
that:
- "result is changed"
when: rhv_found
- name: Delete an RHV credential
credential:
@@ -663,10 +706,12 @@
state: absent
credential_type: Red Hat Virtualization
register: result
when: rhv_found
- assert:
that:
- "result is changed"
when: rhv_found
- name: Create a valid Insights credential
credential:
@@ -678,10 +723,12 @@
username: joe
password: secret
register: result
when: insights_found
- assert:
that:
- "result is changed"
when: insights_found
- name: Delete an Insights credential
credential:
@@ -690,10 +737,12 @@
state: absent
credential_type: Insights
register: result
when: insights_found
- assert:
that:
- "result is changed"
when: insights_found
- name: Create a valid Insights token credential
credential:
@@ -705,10 +754,12 @@
client_id: joe
client_secret: secret
register: result
when: insights_found
- assert:
that:
- "result is changed"
when: insights_found
- name: Delete an Insights token credential
credential:
@@ -717,10 +768,12 @@
state: absent
credential_type: Insights
register: result
when: insights_found
- assert:
that:
- "result is changed"
when: insights_found
- name: Create a valid Tower-to-Tower credential
credential: