Bug#850669: ansible: Enable python3
Hi everyone, I uploaded ansible in experimental that now builds and runs via the python3 interpreter. Please test it extensively and report back any bugs/quirks you find so I can document them in the NEWS file. One thing I found until now is that py2 symantics in jinja2 templates don't work anymore (like `for key, value in foo.iteritems()`), so that's one thing to keep an eye out for. At least once I was able to get ansible to break with a backtrace, but I haven't been able to reproduce it since. Greets, Lee
Bug#850669: ansible: Enable python3
Hello! I'd really love to see ansible with python3 in Buster. I've been using py3 on controllers and targets for some time now and I'm quite happy. Problems usually only arise if third party modules haven't been ported to py3 yet. Is there anything I can help with? Thanks, Jörn signature.asc Description: PGP signature
Bug#850669: ansible: Enable python3
Hi Timo, Laurent, and others, I plan on updating ansible to use python3 on the ansible controller after #848871. That bug is currently missing a last few fixes, an upload to experimental by me and a review by the ftp-masters. I initially considered building an ansible package for py2 and one for py3, but after reviewing the bug list tagged for py3 specific bugs in upstream I think it's an acceptable risk to switch to py3 directly, without offering packages for py2. Part of this bug is also documenting how to switch to py3 on the managed nodes, which can already be done today. However, I'll leave the default there on py2, since most managed machines come with at least python 2.7 (which is required) installed by default, but not always with py3. Debian jessie for example is too old to run ansible on py3, as ansible requires at least 3.5 to run on the managed node. Regards, Lee On 20/11/2018 09:26, Timo Kalliomäki wrote: > Python3 is supported since Ansible 2.5 (March '18). Any updates on the > packaging? Ansible is the only python2 dependent left for me... > > Br, > Timo >
Bug#850669: ansible: Enable python3
Python3 is supported since Ansible 2.5 (March '18). Any updates on the packaging? Ansible is the only python2 dependent left for me... Br, Timo
Bug#850669: ansible: Enable python3
On Mon, 9 Jan 2017 03:24:03 -0500 Jeremy Bicha wrote: > According to the documentation, ansible 2.2 features a tech preview of > python3 support. One reason why that's useful is because several newer > distros do not include python2 by default such as Ubuntu 16.04 LTS and > the next RHEL). > > I am attaching patches in case you want to enable it. > > The easiest way to do this was to enable pybuild. pybuild runs the > upstream tests but they fail for some reason so I skipped them until > that can be investigated. > > It looks like ansible 2.2.1 improves python3 support quite a bit but I > don't know when it will be released. (It's currently at RC2 and 2.2 is > supposed to be a stable series.) Any news for this?
Bug#850669: ansible: Enable python3
Here's another important patch. Thanks, Jeremy Bicha From 93bc20b68d564270e442f75f48ad6d671c9cfa85 Mon Sep 17 00:00:00 2001 From: Jeremy Bicha Date: Mon, 9 Jan 2017 05:38:06 -0500 Subject: [PATCH 3/3] Keep python2 as default --- debian/rules | 4 1 file changed, 4 insertions(+) diff --git a/debian/rules b/debian/rules index b9265e3..773a988 100755 --- a/debian/rules +++ b/debian/rules @@ -7,3 +7,7 @@ export PYBUILD_NAME=ansible # Investigate why the tests are failing override_dh_auto_test: -dh_auto_test + +# We still want python2 as default for Stretch +override_dh_python3: + dh_python3 --shebang=/usr/bin/python -- 2.10.2
Bug#850669: ansible: Enable python3
I forgot to link to the documentation: https://docs.ansible.com/ansible/python_3_support.html Thanks, Jeremy Bicha
Bug#850669: ansible: Enable python3
From ea481b1aa8f1bcabc1052b918c03b25a1fc7ac20 Mon Sep 17 00:00:00 2001 From: Jeremy Bicha Date: Mon, 9 Jan 2017 03:11:58 -0500 Subject: [PATCH 2/2] Build with python3 Closes: #850669 --- debian/control | 9 +++ .../0002-fix-python3-with-openvswitch.patch| 72 ++ debian/patches/series | 1 + debian/rules | 2 +- 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 debian/patches/0002-fix-python3-with-openvswitch.patch diff --git a/debian/control b/debian/control index 030762c..ad1911f 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,14 @@ Uploaders: Michael Vogt Section: admin Priority: optional Build-Depends: debhelper (>= 9), + python3-all, + python3-crypto, + python3-nose, + python3-passlib, + python3-setuptools, + python3-yaml, + python3-jinja2 , + python3-six , python-all, python-crypto, python-setuptools, @@ -23,6 +31,7 @@ Package: ansible Architecture: all Depends: ${misc:Depends}, ${python:Depends}, + ${python3:Depends}, python-crypto, python-yaml, openssh-client | python-paramiko, diff --git a/debian/patches/0002-fix-python3-with-openvswitch.patch b/debian/patches/0002-fix-python3-with-openvswitch.patch new file mode 100644 index 000..06af3c3 --- /dev/null +++ b/debian/patches/0002-fix-python3-with-openvswitch.patch @@ -0,0 +1,72 @@ +From d439271f685c01ace04025f27e7046dd35d988f8 Mon Sep 17 00:00:00 2001 +From: Michael Scherer +Date: Tue, 18 Oct 2016 18:14:02 +0200 +Subject: [PATCH] Make openvswitch* pass py3 sanity check + +https://github.com/ansible/ansible-modules-extras/commit/d439271 +--- + network/openvswitch_bridge.py| 7 +-- + network/openvswitch_port.py | 7 +-- + test/utils/shippable/sanity-skip-python3.txt | 2 -- + 3 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/network/openvswitch_bridge.py b/network/openvswitch_bridge.py +index 68528dd..abe89df 100644 +--- a/lib/ansible/modules/extras/network/openvswitch_bridge.py b/lib/ansible/modules/extras/network/openvswitch_bridge.py +@@ -143,7 +143,8 @@ def check(self): + changed = True + elif self.state == 'present' and not self.exists(): + changed = True +-except Exception, earg: ++except Exception: ++earg = get_exception() + self.module.fail_json(msg=str(earg)) + + # pylint: enable=W0703 +@@ -189,7 +190,8 @@ def run(self): +self.set_external_id(key, None)): + changed = True + +-except Exception, earg: ++except Exception: ++earg = get_exception() + self.module.fail_json(msg=str(earg)) + # pylint: enable=W0703 + self.module.exit_json(changed=changed) +@@ -267,4 +269,5 @@ def main(): + + # import module snippets + from ansible.module_utils.basic import * ++from ansible.module_utils.pycompat24 import get_exception + main() +diff --git a/network/openvswitch_port.py b/network/openvswitch_port.py +index c2224b5..d2bf31a 100644 +--- a/lib/ansible/modules/extras/network/openvswitch_port.py b/lib/ansible/modules/extras/network/openvswitch_port.py +@@ -204,7 +204,8 @@ def check(self): + changed = True + else: + changed = False +-except Exception, earg: ++except Exception: ++earg = get_exception() + self.module.fail_json(msg=str(earg)) + self.module.exit_json(changed=changed) + +@@ -235,7 +236,8 @@ def run(self): + external_id = fmt_opt % (self.port, key, value) + changed = self.set(external_id) or changed + ## +-except Exception, earg: ++except Exception: ++earg = get_exception() + self.module.fail_json(msg=str(earg)) + self.module.exit_json(changed=changed) + +@@ -269,4 +271,5 @@ def main(): + + # import module snippets + from ansible.module_utils.basic import * ++from ansible.module_utils.pycompat24 import get_exception + main() diff --git a/debian/patches/series b/debian/patches/series index 69731bc..dde177e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0001-add-console-manpage.patch +0002-fix-python3-with-openvswitch.patch diff --git a/debian/rules b/debian/rules index 15808e0..b9265e3 100755 --- a/debian/rules +++ b/debian/rules @@ -2,7 +2,7 @@ export PYBUILD_NAME=ansible %: - dh $@ --with python2 --buildsystem=pybuild + dh $@ --with python2,python3 --buildsystem=pybuild # Investigate why the tests are failing override_dh_auto_test: -- 2.10.2
Bug#850669: ansible: Enable python3
Package: ansible Version: 2.2.0.0-1 Severity: wishlist Tags: patch According to the documentation, ansible 2.2 features a tech preview of python3 support. One reason why that's useful is because several newer distros do not include python2 by default such as Ubuntu 16.04 LTS and the next RHEL). I am attaching patches in case you want to enable it. The easiest way to do this was to enable pybuild. pybuild runs the upstream tests but they fail for some reason so I skipped them until that can be investigated. It looks like ansible 2.2.1 improves python3 support quite a bit but I don't know when it will be released. (It's currently at RC2 and 2.2 is supposed to be a stable series.) Thanks, Jeremy Bicha From dea659d43cb650c1698985aaccb7b2514b363298 Mon Sep 17 00:00:00 2001 From: Jeremy Bicha Date: Mon, 9 Jan 2017 03:11:10 -0500 Subject: [PATCH 1/2] Build with pybuild --- debian/control | 2 ++ debian/rules | 7 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 13e8d31..030762c 100644 --- a/debian/control +++ b/debian/control @@ -11,6 +11,8 @@ Build-Depends: debhelper (>= 9), asciidoc, python-nose, python-passlib, + python-jinja2 , + python-six , dh-python Standards-Version: 3.9.8 Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/ansible.git diff --git a/debian/rules b/debian/rules index 86a7d42..15808e0 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,9 @@ #!/usr/bin/make -f +export PYBUILD_NAME=ansible %: - dh $@ --with python2 -Spython_distutils + dh $@ --with python2 --buildsystem=pybuild + +# Investigate why the tests are failing +override_dh_auto_test: + -dh_auto_test -- 2.10.2