Skip to content

Commit 65a96da

Browse files
authored
Fix typos in url lookup plugin options (ansible#81587)
1 parent 509be19 commit 65a96da

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- lookup/url.py - Fix incorrect var/env/ini entry for `force_basic_auth`

lib/ansible/plugins/lookup/url.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@
8181
version_added: "2.10"
8282
default: False
8383
vars:
84-
- name: ansible_lookup_url_agent
84+
- name: ansible_lookup_url_force_basic_auth
8585
env:
86-
- name: ANSIBLE_LOOKUP_URL_AGENT
86+
- name: ANSIBLE_LOOKUP_URL_FORCE_BASIC_AUTH
8787
ini:
8888
- section: url_lookup
89-
key: agent
89+
key: force_basic_auth
9090
follow_redirects:
9191
description: String of urllib2, all/yes, safe, none to determine how redirects are followed, see RedirectHandlerFactory for more information
9292
type: string

test/integration/targets/lookup_url/tasks/main.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,27 @@
5252

5353
- name: Test use_netrc=False
5454
import_tasks: use_netrc.yml
55+
56+
- vars:
57+
ansible_lookup_url_agent: ansible-test-lookup-url-agent
58+
block:
59+
- name: Test user agent
60+
set_fact:
61+
web_data: "{{ lookup('url', 'https://' ~ httpbin_host ~ '/user-agent') }}"
62+
63+
- name: Assert that user agent is set
64+
assert:
65+
that:
66+
- ansible_lookup_url_agent in web_data['user-agent']
67+
68+
- vars:
69+
ansible_lookup_url_force_basic_auth: yes
70+
block:
71+
- name: Test force basic auth
72+
set_fact:
73+
web_data: "{{ lookup('url', 'https://' ~ httpbin_host ~ '/headers', username='abc') }}"
74+
75+
- name: Assert that Authorization header is set
76+
assert:
77+
that:
78+
- "'Authorization' in web_data.headers"

0 commit comments

Comments
 (0)