- Update to 1.6.2
- Include patch from https://github.com/ansible/ansible/pull/7539 Changes to what's given in the PR were discussed and submitted by email. PR: ports/190231 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> (maintainer)
This commit is contained in:
parent
de1d8e3315
commit
38e842d6c3
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355975
6 changed files with 100 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= ansible
|
||||
PORTVERSION= 1.6.1
|
||||
PORTVERSION= 1.6.2
|
||||
CATEGORIES= sysutils python
|
||||
MASTER_SITES= SF/lifanov-ports-distfiles/sysutils/${PORTNAME}/:icons
|
||||
DISTFILES= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} \
|
||||
|
@ -29,7 +29,7 @@ USE_GITHUB= yes
|
|||
GH_ACCOUNT= ${PORTNAME}
|
||||
GH_PROJECT= ${PORTNAME}
|
||||
GH_TAGNAME= ${GH_COMMIT}
|
||||
GH_COMMIT= d4e11c5
|
||||
GH_COMMIT= ce4883b
|
||||
|
||||
USE_PYTHON= 2
|
||||
USE_PYDISTUTILS= yes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SHA256 (ansible-1.6.1.tar.gz) = 02cc980c397d6edabd1353d03a943f4a5931018b6d9caa69a513c68743a3a8b2
|
||||
SIZE (ansible-1.6.1.tar.gz) = 1171854
|
||||
SHA256 (ansible-1.6.2.tar.gz) = 38f90f99c73f4cb9217d07246c851d685d804588b0721de6e31441a1796388ef
|
||||
SIZE (ansible-1.6.2.tar.gz) = 1174221
|
||||
SHA256 (ansible.png) = 9bf68abd2c95db4dc8dfc091c0e0e0a9716891f28d157e3f04e541d96e1c6850
|
||||
SIZE (ansible.png) = 1160
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
--- ./lib/ansible/runner/connection_plugins/paramiko_ssh.py.orig 2014-05-23 16:37:57.000000000 -0400
|
||||
+++ ./lib/ansible/runner/connection_plugins/paramiko_ssh.py 2014-05-31 09:13:44.137967396 -0400
|
||||
@@ -31,6 +31,7 @@
|
||||
import logging
|
||||
import traceback
|
||||
import fcntl
|
||||
+import re
|
||||
import sys
|
||||
from termios import tcflush, TCIFLUSH
|
||||
from binascii import hexlify
|
||||
@@ -210,12 +211,17 @@
|
||||
shcmd, prompt, success_key = utils.make_sudo_cmd(sudo_user, executable, cmd)
|
||||
elif self.runner.su or su:
|
||||
shcmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd)
|
||||
+ prompt_re = re.compile(prompt)
|
||||
vvv("EXEC %s" % shcmd, host=self.host)
|
||||
sudo_output = ''
|
||||
try:
|
||||
chan.exec_command(shcmd)
|
||||
if self.runner.sudo_pass or self.runner.su_pass:
|
||||
- while not sudo_output.endswith(prompt) and success_key not in sudo_output:
|
||||
+ while True:
|
||||
+ if success_key in sudo_output or \
|
||||
+ (self.runner.sudo_pass and sudo_output.endswith(prompt)) or \
|
||||
+ (self.runner.su_pass and prompt_re.match(sudo_output)):
|
||||
+ break
|
||||
chunk = chan.recv(bufsize)
|
||||
if not chunk:
|
||||
if 'unknown user' in sudo_output:
|
|
@ -0,0 +1,32 @@
|
|||
--- ./lib/ansible/runner/connection_plugins/ssh.py.orig 2014-05-23 16:37:57.000000000 -0400
|
||||
+++ ./lib/ansible/runner/connection_plugins/ssh.py 2014-05-31 09:13:44.138967431 -0400
|
||||
@@ -17,6 +17,7 @@
|
||||
#
|
||||
|
||||
import os
|
||||
+import re
|
||||
import subprocess
|
||||
import shlex
|
||||
import pipes
|
||||
@@ -263,6 +264,7 @@
|
||||
|
||||
if su and su_user:
|
||||
sudocmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd)
|
||||
+ prompt_re = re.compile(prompt)
|
||||
ssh_cmd.append(sudocmd)
|
||||
elif not self.runner.sudo or not sudoable:
|
||||
prompt = None
|
||||
@@ -303,7 +305,12 @@
|
||||
sudo_output = ''
|
||||
sudo_errput = ''
|
||||
|
||||
- while not sudo_output.endswith(prompt) and success_key not in sudo_output:
|
||||
+ while True:
|
||||
+ if success_key in sudo_output or \
|
||||
+ (self.runner.sudo_pass and sudo_output.endswith(prompt)) or \
|
||||
+ (self.runner.su_pass and prompt_re.match(sudo_output)):
|
||||
+ break
|
||||
+
|
||||
rfd, wfd, efd = select.select([p.stdout, p.stderr], [],
|
||||
[p.stdout], self.runner.timeout)
|
||||
if p.stderr in rfd:
|
|
@ -0,0 +1,14 @@
|
|||
--- ./lib/ansible/utils/__init__.py.orig 2014-05-23 16:37:57.000000000 -0400
|
||||
+++ ./lib/ansible/utils/__init__.py 2014-05-31 09:13:44.140967223 -0400
|
||||
@@ -952,9 +952,9 @@
|
||||
"""
|
||||
# TODO: work on this function
|
||||
randbits = ''.join(chr(random.randint(ord('a'), ord('z'))) for x in xrange(32))
|
||||
- prompt = 'assword: '
|
||||
+ prompt = '[Pp]assword: ?$'
|
||||
success_key = 'SUDO-SUCCESS-%s' % randbits
|
||||
- sudocmd = '%s %s %s %s -c %s' % (
|
||||
+ sudocmd = '%s %s %s -c "%s -c %s"' % (
|
||||
C.DEFAULT_SU_EXE, C.DEFAULT_SU_FLAGS, su_user, executable or '$SHELL',
|
||||
pipes.quote('echo %s; %s' % (success_key, cmd))
|
||||
)
|
21
sysutils/ansible/files/patch-test__units__TestUtils.py
Normal file
21
sysutils/ansible/files/patch-test__units__TestUtils.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
--- ./test/units/TestUtils.py.orig 2014-05-23 16:37:57.000000000 -0400
|
||||
+++ ./test/units/TestUtils.py 2014-05-31 09:13:44.141967206 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
import unittest
|
||||
import os
|
||||
import os.path
|
||||
+import re
|
||||
import tempfile
|
||||
import yaml
|
||||
import passlib.hash
|
||||
@@ -511,8 +512,8 @@
|
||||
cmd = ansible.utils.make_su_cmd('root', '/bin/sh', '/bin/ls')
|
||||
self.assertTrue(isinstance(cmd, tuple))
|
||||
self.assertEqual(len(cmd), 3)
|
||||
- self.assertTrue(' root /bin/sh' in cmd[0])
|
||||
- self.assertTrue(cmd[1] == 'assword: ')
|
||||
+ self.assertTrue(' root -c "/bin/sh' in cmd[0])
|
||||
+ self.assertTrue(re.compile(cmd[1]))
|
||||
self.assertTrue('echo SUDO-SUCCESS-' in cmd[0] and cmd[2].startswith('SUDO-SUCCESS-'))
|
||||
|
||||
def test_to_unicode(self):
|
Loading…
Reference in a new issue