Mail archive
alpine-aports

[alpine-aports] [PATCH] main/ansible: backport play iteration context patch

From: Sören Tempel <soeren+git_at_soeren-tempel.net>
Date: Thu, 4 Feb 2016 02:35:54 +0100

The patch is already included upstream, but upstream didn't make a new
stable release yet and since this bug is pretty annoying I suggest that
we include this patch until upstream makes a new stable release.

See: https://github.com/ansible/ansible/pull/13793
---
 main/ansible/APKBUILD                | 24 +++++++++++++++++++-----
 main/ansible/iteration-context.patch | 13 +++++++++++++
 2 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 main/ansible/iteration-context.patch
diff --git a/main/ansible/APKBUILD b/main/ansible/APKBUILD
index 00afea0..517a405 100644
--- a/main/ansible/APKBUILD
+++ b/main/ansible/APKBUILD
_at_@ -2,7 +2,7 @@
 # Maintainer: Fabian Affolter <fabian_at_affolter-engineering.ch>
 pkgname=ansible
 pkgver=2.0.0.2
-pkgrel=0
+pkgrel=1
 pkgdesc="A configuration-management, deployment, task-execution, and multinode orchestration framework"
 url="http://ansible.com"
 arch="noarch"
_at_@ -10,9 +10,20 @@ license="GPL3+"
 depends="python py-yaml py-paramiko py-jinja2 py-markupsafe"
 makedepends="python-dev py-setuptools"
 subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::http://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::http://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz
+	iteration-context.patch"
 
 _builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
 build() {
 	cd "$_builddir"
 	python setup.py build || return 1
_at_@ -38,6 +49,9 @@ package() {
 		"$pkgdir"/usr/share/doc/$pkgname/README.extras.md || return 1
 }
 
-md5sums="816d0c49e084383e47a725c761a0e413  ansible-2.0.0.2.tar.gz"
-sha256sums="27db0b99113fab85b1430c361c7790a0aa7f5c614c9af13362e2adbba07e5828  ansible-2.0.0.2.tar.gz"
-sha512sums="bf034384849d3f065ff77982e2e47a94727fc2982f0dac8d67efda2646dcdbd52ba9cc3ddfcdb9cd8210af0935f6f42946cc8ddc659d62cccd670e5d55c7dfa0  ansible-2.0.0.2.tar.gz"
+md5sums="816d0c49e084383e47a725c761a0e413  ansible-2.0.0.2.tar.gz
+e745fcea8520d23386d238d249742741  iteration-context.patch"
+sha256sums="27db0b99113fab85b1430c361c7790a0aa7f5c614c9af13362e2adbba07e5828  ansible-2.0.0.2.tar.gz
+bc11f3095ea9b00e2855a6969bce3764137f54114f979e519e299a5584dfde62  iteration-context.patch"
+sha512sums="bf034384849d3f065ff77982e2e47a94727fc2982f0dac8d67efda2646dcdbd52ba9cc3ddfcdb9cd8210af0935f6f42946cc8ddc659d62cccd670e5d55c7dfa0  ansible-2.0.0.2.tar.gz
+30cc45a485a1048b3e86dea8fc30b65095326e79c0b16ab4d9ab0c8362ec3cefe352500b215858c2b150b2d9a288d3e9bca05c1354969bb16ade2ad123b3df83  iteration-context.patch"
diff --git a/main/ansible/iteration-context.patch b/main/ansible/iteration-context.patch
new file mode 100644
index 0000000..db2ed31
--- /dev/null
+++ b/main/ansible/iteration-context.patch
_at_@ -0,0 +1,13 @@
+diff -upr ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py ansible-2.0.0.2/lib/ansible/executor/task_executor.py
+--- ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py	2016-02-04 00:51:21.944735819 +0100
++++ ansible-2.0.0.2/lib/ansible/executor/task_executor.py	2016-02-04 00:52:26.688134310 +0100
+_at_@ -365,6 +365,9 @@ class TaskExecutor:
+         if not self._connection or not getattr(self._connection, 'connected', False):
+             self._connection = self._get_connection(variables=variables, templar=templar)
+             self._connection.set_host_overrides(host=self._host)
++        # If connection is reused, its _play_context is no longer valid and needs to be replaced
++        # This fixes issues with tasks running sudo in a loop and having the success_key incorrect in the second iteration
++        self._connection._play_context = self._play_context
+ 
+         self._handler = self._get_action_handler(connection=self._connection, templar=templar)
+ 
-- 
2.7.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Thu Feb 04 2016 - 02:35:54 GMT