Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gate python 2/3 shebang fix on version of pip used #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/install-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
path: "{{ duplicity_pip_duplicity_path }}"
regexp: '^\#\!\/usr\/bin\/env\ python3$'
replace: '#!/usr/bin/env python2'
when: ansible_distribution_version is version('20.04', '<')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this when statement because although 18.04 has python 3 duplicity is broken. We probably should do some more investigation. Or did you already do that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually using this role on Raspbian. The PPA repository for duplicity doesn't have arm binaries so I'm using the pip installer with pip3 explicitly named.

- name: "Install pip (rPi)"
  when: inventory_hostname in groups['rpi']
  become: true
  apt:
    update_cache: yes
    pkg:
      - python3-pip

- name: Install duplicity (pip)
  when: inventory_hostname in groups['rpi']
  include_role:
    name: oefenweb.duplicity
    apply:
      become: true
  vars:
    duplicity_install_method: pip
    duplicity_pip_pip_executable: pip3
    duplicity_pip_dependencies_python:
      - duplicity
      - paramiko

With this setup and the current logic the installed duplicity script fails to run as it was installed in using python3 but the fix shebang step essentially breaks things as it ends up trying to run it using python2

when: duplicity_pip_pip_executable == 'pip2'
tags:
- duplicity-install-pip-fix-shebang