1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-12 07:27:57 +00:00

sysutils/ansible: fix prompt for become-method=su

PR:		218724
Reported by:	Guillaume Bibaut <yom@iaelu.net>
This commit is contained in:
Nikolai Lifanov 2017-04-18 17:51:43 +00:00
parent 82fe6f0375
commit 85c2c14f51
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=438787
2 changed files with 26 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= ansible
PORTVERSION?= 2.3.0.0
PORTREVISION?= 0
PORTREVISION?= 1
CATEGORIES= sysutils python
MASTER_SITES= http://releases.ansible.com/ansible/
@ -19,6 +19,8 @@ RUN_DEPENDS?= ${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml \
${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2 \
${PYTHON_PKGNAMEPREFIX}netaddr>0:net/py-netaddr
EXTRA_PATCHES?= ${FILESDIR}/extra-patch-f82d95a
NO_ARCH= yes
USES?= cpe python
USE_PYTHON= autoplist distutils

View File

@ -0,0 +1,23 @@
From f82d95ae288cccae8245236e4d7e6188f0a7d389 Mon Sep 17 00:00:00 2001
From: Matt Martz <matt@sivel.net>
Date: Tue, 18 Apr 2017 11:34:07 -0500
Subject: [PATCH] When become_method is su, self._play_context.prompt is a
function. Fixes #23689
---
lib/ansible/plugins/connection/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/ansible/plugins/connection/__init__.py b/lib/ansible/plugins/connection/__init__.py
index 8a94d6e..6ba4aa2 100644
--- lib/ansible/plugins/connection/__init__.py
+++ lib/ansible/plugins/connection/__init__.py
@@ -258,6 +258,8 @@ def check_password_prompt(self, b_output):
if not b_lines:
return False
return b_lines[-1].strip().endswith(b_prompt) or b_lines[0].strip().endswith(b_prompt)
+ else:
+ return self._play_context.prompt(b_output)
def check_incorrect_password(self, b_output):
b_incorrect_password = to_bytes(gettext.dgettext(self._play_context.become_method, C.BECOME_ERROR_STRINGS[self._play_context.become_method]))