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

Install via pip - how to proceed when a module already exists? #88

Open
JordiBForgeFlow opened this issue May 15, 2018 · 3 comments
Open

Comments

@JordiBForgeFlow
Copy link
Member

JordiBForgeFlow commented May 15, 2018

Currently if you have an existing installation that contains an OCA module installed using pip, that perhaps was installed referring to a PR, and then this PR is merged into OCA, you may get this situation when you do pip install -r requirements.txt:

What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup

The problem is that ansible runs all the steps automatically, and this one is treated as an error.

Perhaps in the ansible role we should always wipe all the OCA modules every time, or force update of them all?

One thing I do not like with the ansible approach is that in general, as the ansible role evolves, the old packages, python modules, etc.. are not going to be removed. This is something that Docker does better, as it creates from scratch every time, ensuring that there's no artifact sitting in the server that is not included in the configuration files.

cc @sbidoul perhaps you know how to force the pip install to always wipe the old pip module?

@sebalix
Copy link
Collaborator

sebalix commented May 16, 2018

Does the forcereinstall option could help here?
http://docs.ansible.com/ansible/latest/modules/pip_module.html

@sbidoul
Copy link
Member

sbidoul commented May 16, 2018

This question (switch/ignore/wite/backup) is typically asked when you try to switch from a https to a ssh git reference (ie when you change from -e git+https://github.com... to -e git@github.com or vice-versa).

You can automate the answer with pip --exists-action or PIP_EXISTS_ACTION env var
https://pip.pypa.io/en/stable/reference/pip/#exists-action-option

Note you may hit this pip 10 bug when uninstalling/reinstalled editable dependencies. If this is an issue for you, stick to pip 9 for the moment.

@sebalix
Copy link
Collaborator

sebalix commented May 23, 2018

@jbeficent setting the PIP_EXISTS_ACTION env var when invoking pip does the trick?
If we update the task to this:

- name: Install Odoo from pip external requirements file
  become: yes
  become_user: "{{ odoo_user }}"
  pip:
    requirements: /home/{{ odoo_user }}/requirements.txt
    extra_args: --upgrade
    virtualenv: "{{ odoo_pip_venv_path }}"
  environment: "{{odoo_pip_env}}"
notify: Restart Odoo

with the new variable odoo_pip_env set to PIP_EXISTS_ACTION: w by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants