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
This commit is contained in:
Kevin Borgolte 2016-07-10 01:17:31 -07:00 committed by René Moser
parent a70cfeed15
commit f1cdafae12

View file

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