From b58bc86c89dc9b05da8cb3280eba5382b8431ed8 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Tue, 16 Jul 2019 06:16:03 -0400 Subject: [PATCH] Silence InsecureRequestWarning and password warning We're making these requests to localhost over an ssh connection. The password warning, on the other hand, is a real thing. Let's not log the gitea password when we run this in prod. Change-Id: I2157e4027dce5ab9ebceb3f78dbeff22a83d9fad --- .../roles/gitea-git-repos/library/gitea_create_repos.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py b/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py index 6f405244aa..a002e7ae61 100755 --- a/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py +++ b/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py @@ -20,6 +20,12 @@ import time import requests import urllib.parse +# urllib3 wants to warn us that we're making insecure requests - when we tell +# it we want to make insecure requests. We know, but in this case the requests +# are not insecure. +import urllib3 +urllib3.disable_warnings() + from ansible.module_utils.basic import AnsibleModule SB_REPO = 'https://storyboard.openstack.org/#!/project/{org}/{repo}' @@ -202,7 +208,7 @@ def ansible_main(): module = AnsibleModule( argument_spec=dict( url=dict(required=True), - password=dict(required=True), + password=dict(required=True, no_log=True), projects=dict(required=True, type='list'), always_update=dict(type='bool', default=True), )