simpler/shorter option names for user

- internally we can keep long names, but user should not require extra typing
This commit is contained in:
Brian Coca 2018-10-11 09:32:09 -04:00 committed by Brian Coca
parent 551de8b166
commit a5bd84758a

View file

@ -26,12 +26,12 @@ options:
description: Flag to control if the lookup will observe HTTP proxy environment variables when present. description: Flag to control if the lookup will observe HTTP proxy environment variables when present.
type: boolean type: boolean
default: True default: True
url_username: username:
description: Username to use for HTTP authentication. description: Username to use for HTTP authentication.
type: string type: string
default: None default: None
version_added: "2.8" version_added: "2.8"
url_password: password:
description: Password to use for HTTP authentication. description: Password to use for HTTP authentication.
type: string type: string
default: None default: None
@ -47,7 +47,7 @@ EXAMPLES = """
debug: msg="{{ lookup('url', 'https://ip-ranges.amazonaws.com/ip-ranges.json', split_lines=False) }}" debug: msg="{{ lookup('url', 'https://ip-ranges.amazonaws.com/ip-ranges.json', split_lines=False) }}"
- name: url lookup using authentication - name: url lookup using authentication
debug: msg="{{ lookup('url', 'https://some.private.site.com/file.txt', url_username='bob', url_password='hunter2') }}" debug: msg="{{ lookup('url', 'https://some.private.site.com/file.txt', username='bob', password='hunter2') }}"
""" """
RETURN = """ RETURN = """
@ -80,8 +80,8 @@ class LookupModule(LookupBase):
try: try:
response = open_url(term, validate_certs=self.get_option('validate_certs'), response = open_url(term, validate_certs=self.get_option('validate_certs'),
use_proxy=self.get_option('use_proxy'), use_proxy=self.get_option('use_proxy'),
url_username=self.get_option('url_username'), url_username=self.get_option('username'),
url_password=self.get_option('url_password')) url_password=self.get_option('password'))
except HTTPError as e: except HTTPError as e:
raise AnsibleError("Received HTTP error for %s : %s" % (term, to_native(e))) raise AnsibleError("Received HTTP error for %s : %s" % (term, to_native(e)))
except URLError as e: except URLError as e: