[MIG][module_auto_update] Backport from v10 - #918
Conversation
|
Cool! all 💚 |
| 'sha1', | ||
| excluded_extensions=exclude, | ||
| ) | ||
| try: |
There was a problem hiding this comment.
Don't do this, but assign dirhash = None in import, and check here if dirhash:, but this should be declared as external dependency, so if the code get this, it's because you make sure the lib to be installed.
There was a problem hiding this comment.
This is here because get_module_path can return False if an addon is installed bus it not found on disk. Then, dirhash raises a TypeError because it expects a str.
There was a problem hiding this comment.
OK, thanks for clarifying. Can you please put the same comment in code for later references?
There was a problem hiding this comment.
It's already there, above the pass
pedrobaeza
left a comment
There was a problem hiding this comment.
The case we have mentioned in the Docker project (new dependency added to installed modules) should be treated also:
- Check which modules need to be updated (already done).
- Update module list (but removing the part in this method that call again to update).
- Check dependencies of these modules.
- If some of the dependencies are not installed, then marked them for being installed.
There's still the chance that your installation doesn't contain the new dependency, but at least we reduce the possibilities.
|
|
||
| .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
| :alt: Try me on Runbot | ||
| :target: https://runbot.odoo-community.org/runbot/149/10.0 |
| 'category': 'Extra Tools', | ||
| 'website': 'https://odoo-community.org/', | ||
| 'author': 'LasLabs, ' | ||
| 'Juan José Scarafía, ' |
|
|
||
| @api.model | ||
| def update_list(self): | ||
| res = super(Module, self).update_list() |
There was a problem hiding this comment.
This should be removed, as it's totally anti-performance, specially on OCB, where installing or updating a module first trigger a module list update, which in case of very large installations will take a lot of time. You already have a method for updating pending modules (running cron job manually), so don't force it here.
There was a problem hiding this comment.
I didn't actually investigate, but I think this could be some of the issue behind the deadlocks I mentioned
There was a problem hiding this comment.
I tested in a production database and indeed running odoo --stop-after-init -u any_module reloads dir hashes for all installed addons. Let's move all of this to the wizard method (which is also the one called from cron and Tecnativa/doodba#64) and I'll forward-port the patches.
|
cc @hughesbm |
|
The refactor goes in no-fixup commits to be able to cherry-pick it later for v10. It required to change some tests. |
| 'sha1', | ||
| excluded_extensions=exclude, | ||
| ) | ||
| _logger.debug("Computed %s for %s", r.checksum_dir, r.name) |
There was a problem hiding this comment.
Nah I think we should move it to the fail case instead (although with fail verbiage instead)
| _logger.debug("Computed %s for %s", r.checksum_dir, r.name) | ||
| except TypeError: | ||
| # Module path not found | ||
| pass |
* [IMP] module_auto_update: Create new module
* Add checksum_dir and checksum_installed fields to ir.module.module
* Add checksum_dir to compute current checksum of module directory
in addons path
* Add checksum_installed to store checksum of module directory
when module was last installed or upgraded
* Use checksumdir Python library to compute module directory sha1
hashes, ignoring pyc and pyo extensions
* Extend update_list method to compare modules' checksum_dir and
checksum_installed, then change state of modules with differing
checksums to 'to upgrade'
* Replace Apps/Updates menu item with menu item of same name, which
updates apps list and displays tree view of ir.module.module
records with state 'to upgrade'
* Extend create and write methods to store computed checksum_dir as
checksum_installed during module installation and upgrade, and
set checksum_installed to False on uninstall
* Use context to stop checksum_installed from being updated during
upgrade/uninstall cancellation
* Add cron job to periodically check for module upgrades by
comparing checksums, then perform any available upgrades
* Extend upgrade_module method (called by cron and 'Apply Scheduled
Upgrades' menu item) to call update_list
* Add post_init_hook to store checksum_installed of existing
modules
* Add test coverage
* [FIX] module_auto_update: Fix test broken by changes
* Use dummy module to test update_list method instead of
module_auto_update
By removing the recomputation from `update_list` we get faster CLI module upgrades and it only performs the autoupdate when using the autoupdate wizard or cron.
bedb81d to
f0ed842
Compare
|
Rebased, squashed for merge |
rafaelbn
left a comment
There was a problem hiding this comment.
We are using it in production enviroments
Syncing from upstream OCA/server-tools (14.0)
Backporting #882
@Tecnativa