summaryrefslogtreecommitdiffstats
path: root/awx_collection
diff options
context:
space:
mode:
authorlucas-benedito <55454581+lucas-benedito@users.noreply.github.com>2023-11-13 16:54:32 +0100
committerGitHub <noreply@github.com>2023-11-13 16:54:32 +0100
commit14f636af8408c78ce1c50ff2e4dbe5b37b710e87 (patch)
tree35a38495698b053b9aa00aaae653ce3c279b8837 /awx_collection
parentDocs: Include REST API reference content from swagger.json (#14607) (diff)
downloadawx-14f636af8408c78ce1c50ff2e4dbe5b37b710e87.tar.xz
awx-14f636af8408c78ce1c50ff2e4dbe5b37b710e87.zip
Setting credential_type as required (#14651)
* Setting credential_type as required * Added test for missing credential_type in credential module * Corrected test assertion --------- Co-authored-by: Lucas Benedito <lbenedit@redhat.com>
Diffstat (limited to 'awx_collection')
-rw-r--r--awx_collection/plugins/modules/credential.py3
-rw-r--r--awx_collection/tests/integration/targets/credential/tasks/main.yml13
2 files changed, 15 insertions, 1 deletions
diff --git a/awx_collection/plugins/modules/credential.py b/awx_collection/plugins/modules/credential.py
index f55574a009..b5fbfe9a4e 100644
--- a/awx_collection/plugins/modules/credential.py
+++ b/awx_collection/plugins/modules/credential.py
@@ -58,6 +58,7 @@ options:
Insights, Machine, Microsoft Azure Key Vault, Microsoft Azure Resource Manager, Network, OpenShift or Kubernetes API
Bearer Token, OpenStack, Red Hat Ansible Automation Platform, Red Hat Satellite 6, Red Hat Virtualization, Source Control,
Thycotic DevOps Secrets Vault, Thycotic Secret Server, Vault, VMware vCenter, or a custom credential type
+ required: True
type: str
inputs:
description:
@@ -214,7 +215,7 @@ def main():
copy_from=dict(),
description=dict(),
organization=dict(),
- credential_type=dict(),
+ credential_type=dict(required=True),
inputs=dict(type='dict', no_log=True),
update_secrets=dict(type='bool', default=True, no_log=False),
user=dict(),
diff --git a/awx_collection/tests/integration/targets/credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml
index 428eab5f8b..34dd058d97 100644
--- a/awx_collection/tests/integration/targets/credential/tasks/main.yml
+++ b/awx_collection/tests/integration/targets/credential/tasks/main.yml
@@ -71,6 +71,19 @@
that:
- "result is changed"
+- name: Delete a credential without credential_type
+ credential:
+ name: "{{ ssh_cred_name1 }}"
+ organization: Default
+ state: absent
+ register: result
+ ignore_errors: true
+
+- assert:
+ that:
+ - "result is failed"
+
+
- name: Create an Org-specific credential with an ID with exists
credential:
name: "{{ ssh_cred_name1 }}"