ansible-openwisp2 icon indicating copy to clipboard operation
ansible-openwisp2 copied to clipboard

[ansible-openwisp2] Upgrade pip deps from requirements on rerun

Open Piyushrathoree opened this issue 3 weeks ago • 2 comments

Checklist

  • [x] I have read the OpenWISP Contributing Guidelines.
  • [x] I have manually tested the changes proposed in this pull request.
  • [ ] I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • [ ] I have updated the documentation.

Reference to Existing Issue

Closes #572

Description of Changes

update the pip.yml file with extra-args:"--upgrade" which make sure that every dependency is updated.

Piyushrathoree avatar Dec 04 '25 17:12 Piyushrathoree

@pandafy PTAL

Piyushrathoree avatar Dec 06 '25 12:12 Piyushrathoree

Good start @Piyushrathoree!

I am afraid that --upgrade might not always work when we use tarball URL as source. E.g. when we set openwisp-controller version in the ansible playbook

openwisp2_controller_version: openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/master

In such scenarios, we would need to use state: forcereinstall.

Using forcereinstall by default will slow down the playbook, since it will make pip reinstall packages even when the latest package have been installed.

I can think of exposing pip.extra_args argument through ansible variable openwisp2_pip_extra_args. The default value for this argument will be openwisp2_pip_extra_args: "--upgrade". When needed, the user can override the variable in the playbook to use `openwisp2_pip_extra_args: "--upgrade --force-reinstall" which will force-reinstall the packages.

We will need to add this new variable in https://github.com/openwisp/ansible-openwisp2/blob/master/docs/user/role-variables.rst, and explain the usage with a comment. You can take reference from other settings mentioned in the file.

thanks @pandafy made some changes according to what you've said , please take a look .

Piyushrathoree avatar Dec 10 '25 10:12 Piyushrathoree