mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Merge pull request #8159 from john-westcott-iv/lookup_plugin_fix
Fixing issue with lookup plugin not able to load host, user, etc Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
56c5a39087
@ -72,6 +72,10 @@ EXAMPLES = """
|
||||
set_fact:
|
||||
tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui') }}"
|
||||
|
||||
- name: Load the UI settings specifying the connection info
|
||||
set_fact:
|
||||
tower_settings: "{{ lookup('awx.awx.tower_api', 'settings/ui' host='tower.example.com', username='admin', password=my_pass_var, verify_ssl=False) }}"
|
||||
|
||||
- name: Report the usernames of all users with admin privs
|
||||
debug:
|
||||
msg: "Admin users: {{ query('awx.awx.tower_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}"
|
||||
@ -131,6 +135,8 @@ class LookupModule(LookupBase):
|
||||
if len(terms) != 1:
|
||||
raise AnsibleError('You must pass exactly one endpoint to query')
|
||||
|
||||
self.set_options(direct=kwargs)
|
||||
|
||||
# Defer processing of params to logic shared with the modules
|
||||
module_params = {}
|
||||
for plugin_param, module_param in TowerAPIModule.short_params.items():
|
||||
@ -144,8 +150,6 @@ class LookupModule(LookupBase):
|
||||
error_callback=self.handle_error, warn_callback=self.warn_callback
|
||||
)
|
||||
|
||||
self.set_options(direct=kwargs)
|
||||
|
||||
response = module.get_endpoint(terms[0], data=self.get_option('query_params', {}))
|
||||
|
||||
if 'status_code' not in response:
|
||||
|
||||
@ -32,6 +32,16 @@
|
||||
register: user_creation_results
|
||||
|
||||
- block:
|
||||
- name: Specify the connection params
|
||||
debug:
|
||||
msg: "{{ query(plugin_name, 'ping', host='DNE://junk.com', username='john', password='not_legit', verify_ssl=True) }}"
|
||||
register: results
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'DNE' in results.msg"
|
||||
|
||||
- name: Create our hosts
|
||||
tower_host:
|
||||
name: "{{ item }}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user