-
Notifications
You must be signed in to change notification settings - Fork 10
Fix/473 quarantine noupdate #479
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
Open
LunarCapsule127
wants to merge
8
commits into
OpenSPP:19.0
Choose a base branch
from
LunarCapsule127:fix/473-quarantine-noupdate
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
516d67a
Update __manifest__.py
LunarCapsule127 c4db10d
Update quarantine_cron.xml
LunarCapsule127 d999884
Create post-migrate.py
LunarCapsule127 0242d54
Update test_pending_scan_sweep.py
LunarCapsule127 48f78fb
fix(spp_attachment_av_scan): address review on quarantine noupdate
LunarCapsule127 a0a3283
Merge branch '19.0' into fix/473-quarantine-noupdate
LunarCapsule127 6302026
docs(spp_attachment_av_scan): regenerate README for the 19.0.2.2.0 entry
LunarCapsule127 ee33f37
Merge branch '19.0' into fix/473-quarantine-noupdate
LunarCapsule127 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
spp_attachment_av_scan/migrations/19.0.2.2.0/post-migrate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import logging | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
| _RECORDS = ( | ||
| "ir_cron_purge_quarantined_files", | ||
| "ir_cron_cleanup_forensic_downloads", | ||
| "config_param_quarantine_retention_days", | ||
| "config_param_forensic_download_retention_hours", | ||
| ) | ||
|
|
||
|
|
||
| def migrate(cr, version): | ||
| """Reconcile ``ir_model_data.noupdate`` for the quarantine crons/params. | ||
|
|
||
| ``data/quarantine_cron.xml`` is declared ``noupdate="1"`` now, and on an | ||
| already-installed database that file-level flag is by itself enough to stop | ||
| the reset: ``xml_import._tag_record`` tests ``self.noupdate``, which | ||
| ``_tag_root`` reads off the ``<odoo>`` element rather than off the stored | ||
| row, and returns before ``_load_records`` whenever the mode is not ``init``. | ||
| So this migration is not what fixes the upgrade rewrite, and no pre-migrate | ||
| is needed; the XML-only fix applied to ``scan_sweep_cron.xml`` in #470 is | ||
| correct as it stands. | ||
|
|
||
| What the XML cannot do is correct the stored rows. | ||
| ``_build_update_xmlids_query`` upserts ``ON CONFLICT ... DO UPDATE SET | ||
| (model, res_id, write_date)`` and never writes ``noupdate``, so every | ||
| database that already carries these xml_ids keeps ``noupdate = false`` in | ||
| ``ir_model_data``. That column is the one ``ir.model.data._process_end`` | ||
| consults, and the one an admin -- or the regression test for these records | ||
| -- reads to confirm they are protected. Flip it once here, and leave the | ||
| stored values alone: tuned values survive and untouched defaults stay as | ||
| shipped. | ||
| """ | ||
| cr.execute( | ||
| """ | ||
| UPDATE ir_model_data | ||
| SET noupdate = TRUE | ||
| WHERE module = 'spp_attachment_av_scan' | ||
| AND name IN %s | ||
| """, | ||
| (_RECORDS,), | ||
| ) | ||
| _logger.info( | ||
| "spp_attachment_av_scan: set noupdate on %s quarantine cron/param records", | ||
| cr.rowcount, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version goes to
19.0.2.2.0butreadme/HISTORY.mdstill ends at### 19.0.2.1.0, and no fragment is added. Every other released version of this module has a matching### <version>section (19.0.2.0.1,19.0.2.0.2,19.0.2.1.0), andREADME.rst/README.mdrender their changelog from that file, so the shipped module will advertise19.0.2.2.0while its published changelog stops at the previous version -- an admin reading the README has no record that the quarantine crons/params becamenoupdateand that a migration touchedir_model_data.oca-gen-addon-readmeruns--if-source-changed, so pre-commit stays green and the gap ships silently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a ### 19.0.2.2.0 fragment to readme/HISTORY.md covering both halves the file becoming noupdate="1" and the post-migration reconciling ir_model_data and regenerated README.rst / static/description/index.html so the published changelog no longer stops a version short of what the manifest advertises.