mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Change lookup to include organization
This commit is contained in:
committed by
beeankha
parent
5c9ff51248
commit
8b881d195d
@@ -45,7 +45,7 @@ options:
|
||||
credential_type:
|
||||
description:
|
||||
- Name of credential type.
|
||||
- Will be prefered over kind
|
||||
- Will be preferred over kind
|
||||
required: False
|
||||
version_added: "2.10"
|
||||
type: str
|
||||
@@ -340,13 +340,14 @@ def main():
|
||||
|
||||
cred_type_id = module.resolve_name_to_id('credential_types', credential_type if credential_type else KIND_CHOICES[kind])
|
||||
|
||||
# Attempt to look up the object based on the provided name and inventory ID
|
||||
credential = module.get_one('credentials', **{
|
||||
'data': {
|
||||
'name': name,
|
||||
'credential_type': cred_type_id,
|
||||
}
|
||||
})
|
||||
# Attempt to look up the object based on the provided name, credential type and optional organization
|
||||
lookup_data = {
|
||||
'name': name,
|
||||
'credential_type': cred_type_id,
|
||||
}
|
||||
if organization:
|
||||
lookup_data['organization'] = org_id
|
||||
credential = module.get_one('credentials', **{'data': lookup_data})
|
||||
|
||||
# Create credential input from legacy inputs
|
||||
credential_inputs = {}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
organization: Default
|
||||
user: admin
|
||||
kind: ssh
|
||||
authorize: False
|
||||
authorize: false
|
||||
authorize_password: 'test'
|
||||
client: 'test'
|
||||
security_token: 'test'
|
||||
@@ -62,7 +62,7 @@
|
||||
vault_id: 'test'
|
||||
ssh_key_unlock: 'test'
|
||||
state: absent
|
||||
ignore_errors: True
|
||||
ignore_errors: true
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
@@ -125,7 +125,6 @@
|
||||
- name: Delete a User-specific credential
|
||||
tower_credential:
|
||||
name: "{{ ssh_cred_name1 }}"
|
||||
organization: Default
|
||||
user: admin
|
||||
state: absent
|
||||
kind: ssh
|
||||
@@ -253,7 +252,7 @@
|
||||
ssh_key_data: "{{ tempdir.stdout }}/id_rsa"
|
||||
ssh_key_unlock: "passphrase"
|
||||
register: result
|
||||
ignore_errors: True
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
@@ -353,7 +352,7 @@
|
||||
description: An example Vault credential
|
||||
vault_password: secret-vault
|
||||
register: result
|
||||
ignore_errors: True
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
||||
Reference in New Issue
Block a user