Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: add pass-credentials key #282

Merged
merged 7 commits into from
Nov 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions plugins/modules/helm_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
default: present
aliases: [ state ]
type: str
pass_credentials:
description:
- Pass credentials to all domains.
required: false
default: false
type: boolean
nkromano marked this conversation as resolved.
Show resolved Hide resolved
nkromano marked this conversation as resolved.
Show resolved Hide resolved
"""

EXAMPLES = r"""
Expand Down Expand Up @@ -157,14 +163,17 @@ def get_repository_status(module, command, repository_name):

# Install repository
def install_repository(
command, repository_name, repository_url, repository_username, repository_password
command, repository_name, repository_url, repository_username, repository_password, pass_credentials
nkromano marked this conversation as resolved.
Show resolved Hide resolved
):
install_command = command + " repo add " + repository_name + " " + repository_url

if repository_username is not None and repository_password is not None:
install_command += " --username=" + repository_username
install_command += " --password=" + repository_password

if pass_credentials:
install_command += " --pass-credentials"

return install_command


Expand All @@ -188,6 +197,7 @@ def main():
repo_state=dict(
default="present", choices=["present", "absent"], aliases=["state"]
),
pass_credentials=dict(type="bool", default=False)
nkromano marked this conversation as resolved.
Show resolved Hide resolved
),
required_together=[["repo_username", "repo_password"]],
required_if=[("repo_state", "present", ["repo_url"])],
Expand All @@ -205,6 +215,7 @@ def main():
repo_username = module.params.get("repo_username")
repo_password = module.params.get("repo_password")
repo_state = module.params.get("repo_state")
pass_credentials = module.params.get("pass_credentials")

if bin_path is not None:
helm_cmd = bin_path
Expand All @@ -219,7 +230,7 @@ def main():
elif repo_state == "present":
if repository_status is None:
helm_cmd = install_repository(
helm_cmd, repo_name, repo_url, repo_username, repo_password
helm_cmd, repo_name, repo_url, repo_username, repo_password, pass_credentials
nkromano marked this conversation as resolved.
Show resolved Hide resolved
)
changed = True
elif repository_status["url"] != repo_url:
Expand Down