mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 10:41:05 -03:30
Initial fixes from github comments
This commit is contained in:
@@ -30,13 +30,13 @@ options:
|
|||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: Lookup a users ID
|
- name: Lookup a users ID
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ query('awx.awx.tower_api', 'users', query_params={ 'username': 'admin' }) }}"
|
msg: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username': 'admin' }) }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
_raw:
|
_raw:
|
||||||
description:
|
description:
|
||||||
- The ID found for the filter criteria
|
- The ID found for the filter criteria returned as a string (i.e. "42" instead of 42).
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -50,31 +50,22 @@
|
|||||||
that:
|
that:
|
||||||
- users['results'] | length() == 1
|
- users['results'] | length() == 1
|
||||||
- users['count'] == 1
|
- users['count'] == 1
|
||||||
|
- users['results'][0]['id'] == user_creation_results['results'][0]['id']
|
||||||
- name: Get the id of the admin users
|
|
||||||
set_fact:
|
|
||||||
user_id: "{{ (query('awx.awx.tower_api', 'users', query_params=query_params) | json_query(jmes_query))[0] }}"
|
|
||||||
vars:
|
|
||||||
query_params:
|
|
||||||
username: "{{ user_creation_results['results'][0]['item'] }}"
|
|
||||||
jmes_query: 'results[*].id'
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that: "{{ user_id }} == {{ user_creation_results['results'][0]['id'] }}"
|
|
||||||
|
|
||||||
- name: Get a page of users
|
- name: Get a page of users
|
||||||
set_fact:
|
set_fact:
|
||||||
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'page_size': 2 } ) }}"
|
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'username__endswith': test_id, 'page_size': 2 } ) }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: users['results'] | length() == 2
|
that: users['results'] | length() == 2
|
||||||
|
|
||||||
- name: Get all users of a system through next attribute
|
- name: Get all users of a system through next attribute
|
||||||
set_fact:
|
set_fact:
|
||||||
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'page_size': 1, }, get_all=true ) }}"
|
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'username__endswith': test_id, 'page_size': 1 }, get_all=true ) }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: users['results'] | length() >= 3
|
that:
|
||||||
|
- users['results'] | length() >= 3
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Cleanup users
|
- name: Cleanup users
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
- result is failed
|
- result is failed
|
||||||
- "'The requested object could not be found at' in result.msg"
|
- "'The requested object could not be found at' in result.msg"
|
||||||
|
|
||||||
- name: Get the ID of the admin user
|
- name: Get the ID of the first user created
|
||||||
set_fact:
|
set_fact:
|
||||||
user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
- name: Lookup too many users
|
- name: Lookup too many users
|
||||||
set_fact:
|
set_fact:
|
||||||
too_many_user_ids: " {{ query('awx.awx.tower_get_id', 'users', query_params={ 'username__startswith': 'AWX-Collection-tests-tower_get_id-' }) }}"
|
too_many_user_ids: " {{ query('awx.awx.tower_get_id', 'users', query_params={ 'username__endswith': test_id }) }}"
|
||||||
register: results
|
register: results
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user