Fix Kubernetes API auth regression from 393e43b8 (#2503)

* Fix Kubernetes API auth regression from 393e43b8

Commit 393e43b8 renames url_username and url_password to username and
password, which breaks authentication to a Kubernetes API endpoint as
fetch_url() in ansible.module_utils.urls relies on url_username and
url_password being set.

* Add aliases for clustering/kubernetes.py

- username as alias for url_username
- password as alias for url_password
pull/18777/head
Kevin Borgolte 8 years ago committed by Matt Clay
parent 842394b1ab
commit 026dc4f957

@ -61,16 +61,18 @@ options:
required: true required: true
default: "present" default: "present"
choices: ["present", "absent", "update", "replace"] choices: ["present", "absent", "update", "replace"]
password: url_password:
description: description:
- The HTTP Basic Auth password for the API I(endpoint). This should be set - The HTTP Basic Auth password for the API I(endpoint). This should be set
unless using the C('insecure') option. unless using the C('insecure') option.
default: null default: null
username: aliases: ["password"]
url_username:
description: description:
- The HTTP Basic Auth username for the API I(endpoint). This should be set - The HTTP Basic Auth username for the API I(endpoint). This should be set
unless using the C('insecure') option. unless using the C('insecure') option.
default: "admin" default: "admin"
aliases: ["username"]
insecure: insecure:
description: description:
- "Reverts the connection to using HTTP instead of HTTPS. This option should - "Reverts the connection to using HTTP instead of HTTPS. This option should
@ -92,8 +94,8 @@ EXAMPLES = '''
- name: Create a kubernetes namespace - name: Create a kubernetes namespace
kubernetes: kubernetes:
api_endpoint: 123.45.67.89 api_endpoint: 123.45.67.89
username: admin url_username: admin
password: redacted url_password: redacted
inline_data: inline_data:
kind: Namespace kind: Namespace
apiVersion: v1 apiVersion: v1
@ -111,8 +113,8 @@ EXAMPLES = '''
- name: Create a kubernetes namespace - name: Create a kubernetes namespace
kubernetes: kubernetes:
api_endpoint: 123.45.67.89 api_endpoint: 123.45.67.89
username: admin url_username: admin
password: redacted url_password: redacted
file_reference: /path/to/create_namespace.yaml file_reference: /path/to/create_namespace.yaml
state: present state: present
@ -306,8 +308,8 @@ def main():
argument_spec=dict( argument_spec=dict(
http_agent=dict(default=USER_AGENT), http_agent=dict(default=USER_AGENT),
username=dict(default="admin"), url_username=dict(default="admin", aliases=["username"]),
password=dict(default="", no_log=True), url_password=dict(default="", no_log=True, aliases=["password"]),
force_basic_auth=dict(default="yes"), force_basic_auth=dict(default="yes"),
validate_certs=dict(default=False, type='bool'), validate_certs=dict(default=False, type='bool'),
certificate_authority_data=dict(required=False), certificate_authority_data=dict(required=False),
@ -317,7 +319,9 @@ def main():
inline_data=dict(required=False), inline_data=dict(required=False),
state=dict(default="present", choices=["present", "absent", "update", "replace"]) state=dict(default="present", choices=["present", "absent", "update", "replace"])
), ),
mutually_exclusive = (('file_reference', 'inline_data'), ('username', 'insecure'), ('password', 'insecure')), mutually_exclusive = (('file_reference', 'inline_data'),
('url_username', 'insecure'),
('url_password', 'insecure')),
required_one_of = (('file_reference', 'inline_data'),), required_one_of = (('file_reference', 'inline_data'),),
) )

Loading…
Cancel
Save