[libvirt] [jenkins-ci PATCH 3/3] lcitool: Fix pip use on CentOS 7

Andrea Bolognani posted 3 patches 6 years, 1 month ago
[libvirt] [jenkins-ci PATCH 3/3] lcitool: Fix pip use on CentOS 7
Posted by Andrea Bolognani 6 years, 1 month ago
The 'pip' Ansible module doesn't work correctly when there is a
mismatch between the Python version we're adding packages to and
the one used to run Ansible itself: this is the case on CentOS 7,
where we have Python 3 for the former but Python 2 for the latter.

Call pip3 manually using the 'command' module instead to work
around this issue.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/playbooks/update/tasks/packages.yml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/guests/playbooks/update/tasks/packages.yml b/guests/playbooks/update/tasks/packages.yml
index fc8a3d1..4e7d5f6 100644
--- a/guests/playbooks/update/tasks/packages.yml
+++ b/guests/playbooks/update/tasks/packages.yml
@@ -143,7 +143,8 @@
     - pip_resolved[item] not in pip_flattened
 
 - name: '{{ project }}: Install packages from pip (state={{ state }})'
-  pip:
-    name: '{{ pip_flattened|sort }}'
-    executable: pip3
-    state: '{{ state }}'
+  command: 'pip3 install {{ item }}'
+  args:
+    warn: no
+  with_items:
+    '{{ pip_flattened|sort }}'
-- 
2.24.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [jenkins-ci PATCH 3/3] lcitool: Fix pip use on CentOS 7
Posted by Daniel P. Berrangé 6 years, 1 month ago
On Tue, Jan 07, 2020 at 04:50:20PM +0100, Andrea Bolognani wrote:
> The 'pip' Ansible module doesn't work correctly when there is a
> mismatch between the Python version we're adding packages to and
> the one used to run Ansible itself: this is the case on CentOS 7,
> where we have Python 3 for the former but Python 2 for the latter.
> 
> Call pip3 manually using the 'command' module instead to work
> around this issue.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/playbooks/update/tasks/packages.yml | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list