-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
auto_backup: allow to change the format of backup #1333
Conversation
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.
Minor issue
cached = open(backup) | ||
else: | ||
cached = db.dump_db(self.env.cr.dbname, None) | ||
for rec in sftp: |
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.
@foutoucour the if statement can be removed since you loop on the for.
docker-compose.yml
Outdated
@@ -0,0 +1,29 @@ | |||
version: '3' |
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.
Could you remove file docker-compose.yml
from this PR?
auto_backup/models/db_backup.py
Outdated
@@ -83,6 +83,13 @@ class DbBackup(models.Model): | |||
"read permissions for that file.", | |||
) | |||
|
|||
backup_format = fields.Selection( | |||
[("dump.zip", "zip (includes filestore)"), ("dump", "pg_dump custom format (without filestore)")], |
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.
Shouldn't be "zip
" here? I'm wondering how this functionality could work fine with "dump.zip
" passed to dump_db()
🤔
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.
True!
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.
@astirpe fixed!
@@ -175,18 +175,6 @@ def test_action_backup_sftp_remote_open(self): | |||
'wb' | |||
) | |||
|
|||
def test_action_backup_sftp_remote_open(self): |
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.
Why this test was removed?
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.
Hello,
I found that it is the same test than the previous test
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.
Your're right
auto_backup/models/db_backup.py
Outdated
("zip", "zip (includes filestore)"), | ||
("dump", "pg_dump custom format (without filestore)") | ||
], | ||
string="Backup Format", |
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.
No need to write string="Backup Format",
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.
Question of style. I prefer explicit declaration that implicit declaration.
Has OCA guide on this that I didn't see?
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.
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.
👍
remove string parameter
@astirpe could you approve the PR? Thank you. |
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.
Code review ok
auto_backup: use rec.backup_format in cleanup function
auto_backup: use rec.backup_format in cleanup function
auto_backup: use rec.backup_format in cleanup function
auto_backup: use rec.backup_format in cleanup function
* OCA Transbot updated translations from Transifex * Module 'auditlog' - A log can be created with no current HTTP request (unit tests, ir.cron...) * Module 'auditlog' - 'display_name' fields added for the user session and HTTP requests models * Module 'auditlog' - Fix pylint check * turn off prefetching when reding values * auditlog - Ability to choose the log type on the rule: Full log (complete but slow) and Fast log (data input only, faster) * auditlog - Field 'type' renamed to 'log_type' * auditlog - Auto-vacuum logs, HTTP requests and HTTP user sessions * auditlog - Bump version number * auditlog - Icon added + README updated (screenshots) * Migrate auditlog module from 8.0 to 9.0 - Update documentation to point to the new auditlog menu locations. These were changed because the 8.0 version was referencing menus that do not exist in 9.0 - Change version from 8.0.X.Y.Z to 9.0.1.0.0 - Make the module installable again - Remove an unused parameter from pre-migration.py for versioning - Fix typos and remove commented out blocks of code that were irrelevant * Updated the __openerp__.xml to include the license and images fields These were updated to follow OCA conventions. - License set to AGPL-3 - Images set to empty array * auditlog module, Remove duplicate license key from openerp config * auditlog: Remove migration from audittrail functionality, this is not required for version 9 * auditlog: Remove pre_init_hook reference from openerp, no pre_init hook exists any more * singleton error if we saved the current session two times (OCA#473) * [IMP] index the columns we'll be searching for for every request * [FIX] singleton error if we saved the current session two times * auditlog - Lint * auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.write' methods to the new API * [FIX] Request id no longer exists after concurrency rollback * [MIG] auditlog: Migrated to 10.0 * [FIX] auditlog: Duplicate logging * Update _patch_methods and _revert_methods in auditlog.rule model to properly track whether a method has already been patched for logging purposes. This prevents duplicate logs from being produced in various cases (e.g. when a logging rule is created as part of a module install) * [MIG] auditlog: Migration to 11.0 * [add] https * OCA Transbot updated translations from Transifex * remove obsolete .pot files [ci skip] * [UPD] Update auditlog.pot * Translated using Weblate Currently translated at 100,0% (70 of 70 strings) Translation: server-tools-11.0/server-tools-11.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-11-0/server-tools-11-0-auditlog/pt_BR/ * [ADD] split module sale_exception into base_exception * OCA Transbot updated translations from Transifex * Fix menu in base_exception (OCA#803) * Fix menu in base_exception * Fix base_exception/views/base_exception_view.xml * [FIX] base_exception: '_check_exception' is 'api.multi' since it's called by constraint methods 'detect_exception' can be called on an empty recordset. * [MIG] base_exception: Migration to 11.0 * style fixes * [FIX] temp model test access rule & fix OCA remarks * Refactor tests of module 'base_exception'. Defines a new mechanism to build odoo classes that are only defined during testing. * [FIX] Enable post_install for tests + pylint * [IMP] Update base_exception views - Show menu only to Exception Rule Managers - Use sequence and active widgets on tree view - Updated form to use sheet * FIX remove old api parameters in base_exception * [FIX] base_exception: send the active_model in the conxtext when call the _popup_exceptions mehtod * [WIP] sale_exception_by_domain * [MIG] base_exception: Migration to 12.0 * add execution rule based instead of record based improve the perfs dramastically when there is a lot of records * Remove onchange on exception_type No more empty fields after changing type. * Update readme Add a note about safe_eval * base_exception allow to filter rules in inherited modules * FIX self[0] in _rule_group * [MIG] dict.iteritems() does not exist in Python3 * [MIG] auditlog: Migration to 12.0 * [UPD] README.rst * [IMP] auditlog: set all fields readonly when the rule is enabled * [UPD] README.rst * [ADD] setup.py * [UPD] Update auditlog.pot * Update english pot file Added all the new fields and sentences. This will be the template for translations. * Open FTP session on the last moment possible Used to open fp = open(file_path,'wb') a few lines before it was needed. This shouldn't be too much of a problem but opening and closing it right after eachother keeps the session open for less time and there are less chances on failure. * [auto_backup] Refactor. - Follow template README. - Remove HTML README. - Move models to models folder. - Model and view file names follow guidelines. - Unused methods cleanup. - Remove unneeded `.pot` file. - Fix permissons. - Follow PEP8 in names everywhere. - Set more descriptive field names. - Disable backups for other databases, for security. - Remove db name from generated file, for easier cleanup. - EAFP logic everywhere. - More descriptive name. - Data files moved to YAML, with cleaner ir.cron record creation. - Add permissions for db.backup model. - Icons. - Update tests with new format. - Storage method is a selectable, for easier extensibility. - Instead of custom mailing, it just has a mail thread where you can subscribe. - Should fix almost all comments in OCA#203. - Reduce headers. This respects the upstream license choice (GPL/AGPL) but reduces verbosity. It would be ideal to have everything under AGPL though. * FIX License type * OCA Transbot updated translations from Transifex * [FIX] auto_backup: bad reference to field sftp_private_key (OCA#423) Bump module version to 8.0.1.0.1 * [FIX] logger db_backup for pysftp (OCA#419) * [FIX] remove en.po that was erroneously created by transbot * [MIG] auto_backup: Migrate to v9 * Add self.ensure_ones * Add test coverage * [auto_backup] FIX: failure type notification Fixes OCA#710 * [10.0][auto_backup] Menu entry moved (OCA#735) * [10.0][auto_backup] Menu entry moved * Update version in manifest * FIX sftp unlink path (OCA#767) * Fix icon Test SFTP Connection (OCA#825) * [11.0][MIG] auto_backup * OCA Transbot updated translations from Transifex * [FIX] syntax error in nl.po * [UPD] Update auto_backup.pot * Translated using Weblate (Dutch) Currently translated at 58.2% (32 of 55 strings) Translation: server-tools-11.0/server-tools-11.0-auto_backup Translate-URL: https://translation.odoo-community.org/projects/server-tools-11-0/server-tools-11-0-auto_backup/nl/ * [FIX] auto_backup: Fix NL translation * auto_backup: allow to change the format of backup (OCA#1333) * [UPD] Update auto_backup.pot * [MIG] auto_backup: Migration to 12.0 Added test coverage Added requirements.txt for pysftp Added in the roadmap the exact version of pysftp for this to work (0.2.8) Added in the roadmap the problem with list_db=False Adapted calls to message_post * Migrate base_technical_user to version 12 * [UPD] README.rst * [ADD] setup.py * [UPD] Update base_exception.pot * [UPD] Update sql_export.pot * [UPD] Update base_technical_user.pot * [UPD] Update auto_backup.pot * [FIX] title level in readme fragments * [UPD] README.rst * [ADD] setup.py * [UPD] README.rst * [ADD] icon.png * [ADD] setup.py * [UPD] Update onchange_helper.pot * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-auditlog/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-auto_backup Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-auto_backup/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-base_exception Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_exception/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-base_technical_user Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_technical_user/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-onchange_helper Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-onchange_helper/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-sql_export Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-sql_export/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-sql_request_abstract Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-sql_request_abstract/ * IMP sql_export: render field as require when matching field def * [FIX] Add migration scripts to v12 * [add] base_fontawesome (OCA#866) * [MIG][10.0] base_fontawesome * [UPD] Update base_fontawesome.pot * [MIG] base_fontawesome: Migration to 11.0 * [UPD] Update base_fontawesome.pot * [UPD] README.rst * Added translation using Weblate (Spanish) * Upgrade to FontAwesome 5.5.0 * Update to version 5.7.1 * [MIG] base_Fontawesome * [ADD] Database cleanup module * remove relations when purging models avoid ''NoneType' object has no attribute 'exists'' error when purging models fix my change guewen.baconnier@camptocamp.com-20140203103254-v1mzu2uib047xb9h, wrong lines replaced... * [FIX] Don't remove uid field from wkf_instance, which is written in raw SQL query (but never read afterwards). Workaround for lp:1277899 [FIX] Preserve dangling workflow table which is in use [RFR] Group models per table when detecting columns to purge to prevent problems with models sharing the same table [ADD] Allow purging of dangling data entries [FIX] Data purging now working [IMP] Docstrings [FIX] Label [FIX] Catch attempt to unlink field from nonexisting model [RFR] Flake8 * [CHG] Migration to 8.0 [CHG] database_cleanup: move description to README.rst * [IMP] hide unnecessary buttons in wizard [IMP] order wizard lines by name [IMP] deal with modules whose models can't be loaded [IMP] double quotes for docstring [FIX] use exists query instead of huge in list [IMP] hide unnecessary buttons in wizard II [IMP] readability [FIX] cope with purging nonexisting models * Missing templates and translations added * [ADD] allow to clean up menus * [IMP] allow to select lines to purge in a tree view [IMP] adaptto upstream changes * [ADD] migrate database_cleanup [ADD] test purging modules [ADD] test purging tables * OCA Transbot updated translations from Transifex * [FIX] purge uninstalled uninstallable modules instead of deleting [FIX] database_cleanup reloads the registry which has weird side effects during testing. Take care database_cleanup's tests don't mess up the following tests * [RFR] Explicit access rights so that tests can run Fixes OCA#505 * [IMP] call the button handler to also purge reverse dependencies * [FIX] don't crash if an xmlid refers to a nonexisting field (OCA#559) * [FIX] clean database menus was proposing good menus to purge (OCA#562) * fixes OCA#587 * [FIX] database_cleanup: Fix test (OCA#612) * [9.0][FIX] database_cleanup: Isolate build (OCA#719) * [FIX] database_cleanup: Isolate build * Isolate `database_cleanup` into its own build in Travis file to fix OCA#689 * [FIX] database_cleanup: Remove KeyError assertion * Remove KeyError assertion in tests due to PR in comment being merged * [ADD] allow creating missing indexes and purging properties (OCA#736) * [ADD] allow creating missing indexes * [FIX] tests; installation * [ADD] allow purging properties * [ADD] missing file * [ADD] test purging properties * [ADD] missing parent_id for menu entry * [FIX] don't delete too many and wrong properties * [MIG] database_cleanup: Migration to version 10.0 Using new base model inheritance. * [FIX] really uninstall modules and avoid a crash on cached data [FIX] don't try to uninstall uninstalled modules [DEL] weird code [FIX] actually cleanup where we can * [ADD] [database_cleanup] migrate to 11.0 * OCA Transbot updated translations from Transifex * database_cleanup_fix_runbot_links * Global pylint cleanup * [MIG] database_cleanup: migration to 12.0 Update version number Use correct import Update .pot to match new syntax Adapt icon to fontawesome Add models description Rename field external id to new syntax <model>__<field> * [FIX] don't destroy values when there are empty default properties * [FIX] show the redundant property's res_id, not the default one's * [IMP] don't break on properties pointing to unknown models * [FIX] database_cleanup: exclude password fields cf discussion on OCA#1408 * [I18N] database_cleanup: reflect changes to en.po To match the new database_cleanup.pot * [FIX] database_cleanup: filter on many2many fields Following odoo/odoo@54238c88e85d6e a Many2many may have no relation This avoids having a None record in the list (which is problematic with the NOT IN clause) https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_NOT_IN * [IMP] travis: isolate database_cleanup again Cherry-pick of d464fb2 to 12.0 * [FIX] database_cleanup: ignore to_buy modules Since 12.0, some virtual modules are created as an incentive to buy enterprise Hide installation warning * [ADD] setup.py * [UPD] Update database_cleanup.pot * Refactore base_exception in order to drastically simplify it * [UPD] README.rst * [ADD] setup.py * [UPD] Update base_fontawesome.pot * [UPD] Update base_exception.pot * FIX base_exception: typo * [UPD] Update base_exception.pot * Fix intersection operator * Fix union between recordset and parent recordset in base_exception * [UPD] Update base_exception.pot * [ADD] module fetchmail_notify_error_to_sender * OCA Transbot updated translations from Transifex * Fix Travis (OCA#616) * [FIX] auth_from_http_remote_user - Lint * [FIX] server_environment - Lint * [FIX] base_module_doc_rst - Lint * [FIX] fetchmail_notify_error_to_sender - Fix XML view, it was the 'active' field from 'fetchmail_attach_from_folder' module which was targeted by mistake (belonging to another data model) * [MIG] fetchmail_notify_error_to_sender * porting fetchmail_notify_error_to_sender to 10.0 * OCA Transbot updated translations from Transifex * [MIG] fetchmail_notify_error_to_sender: Migration to 10.0 * OCA Transbot updated translations from Transifex * [MIG] fetchmail_notify_error_to_sender: Migration to 11.0 * [11.0] [MIG] [fetchmail_notify_error_to_sender] - readme, tests, fix template tech. msg issue * [UPD] Update fetchmail_notify_error_to_sender.pot * [UPD] README.rst * [MIG] fetchmail_notify_error_to_sender: Migration to 12.0 * [FIX] fetchmail_notify_error_to_sender: fix test * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-base_exception Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_exception/ * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-database_cleanup Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-database_cleanup/ * [UPD] README.rst * [ADD] setup.py * [UPD] Update fetchmail_notify_error_to_sender.pot * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-fetchmail_notify_error_to_sender Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-fetchmail_notify_error_to_sender/ * [10.0][MIG] base_cron_exclusion (OCA#1105) * [9.0][ADD] base_cron_exclusion * [10.0][MIG] base_cron_exclusion [11.0][MIG] base_cron_exclusion * OCA Transbot updated translations from Transifex * [FIX] manifest version * [UPD] Update base_cron_exclusion.pot * Global pylint cleanup * [UPD] Update base_cron_exclusion.pot * Update translation files Updated by Update PO files to match POT (msgmerge) hook in Weblate. * [MIG] base_cron_exclusion: Migration to 12.0 * [UPD] Update base_cron_exclusion.pot * [UPD] README.rst * [ADD] setup.py * Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-12.0/server-tools-12.0-base_cron_exclusion Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_cron_exclusion/ * [ADD] new module module_analysis * fixup! [ADD] new module module_analysis * fixup! fixup! [ADD] new module module_analysis * fixup! fixup! fixup! [ADD] new module module_analysis * fixup! fixup! fixup! fixup! [ADD] new module module_analysis * IMP exception message * fixup! fixup! fixup! fixup! fixup! [ADD] new module module_analysis * [REF] remove use of cloc. use pygount librairy instead * fixup! [REF] remove use of cloc. use pygount librairy instead * fixup! fixup! [REF] remove use of cloc. use pygount librairy instead * Apply suggestions from code review Co-Authored-By: David Beal <david.beal@akretion.com> * Update module_analysis/views/menu.xml Co-Authored-By: David Beal <david.beal@akretion.com> * Update module_analysis/tests/test_module.py Co-Authored-By: David Beal <david.beal@akretion.com> * Update module_analysis/readme/CONFIGURE.rst Co-Authored-By: David Beal <david.beal@akretion.com> * [IMP] handle encoding * [UPD] Update module_analysis.pot * [UPD] README.rst * [ADD] setup.py * [UPD] README.rst * [ADD] dbfilter_from_header * [MIG] dbfilter_from_header: Migration to 8.0 * [ADD] - cherry picked 5737ebc * [ADD] - dbfilter_from_header: Added module to version 9.0. * [FIX] - dbfilter_from_header: Updated the module to latest conventions. * [MIG] migrate dbfilter_from_header to 10.0 (OCA#571) [MIG] migrate dbfilter_from_header to 10.0 I have also removed the ability to use HTTP_X_OPENERP_DBFILTER * [11.0][MIG] dbfilter_from_header updates were made in OCA#1137 by @TimLai125 and small lint fixes by @yelizariev * [FIX] dbfilter_from_header: prevent autoloading * [MIG] dbfilter_from_header: Migration to 12.0 * [UPD] Update dbfilter_from_header.pot * [UPD] README.rst * [ADD] setup.py * [12.0] base_cron_exclusion to LGPL Change license to LGPL to not limit the usage of this module in private customizations. * [UPD] README.rst * [12.0][FIX] excel_import_export Fix Import Excel wizard, cannot download template as in v12 core Odoo prevent download default binary. * [UPD] Update excel_import_export.pot * [UPD] README.rst * [12.0][FIX] excel_import_export, use sudo() to get param * [UPD] README.rst * [FIX][OCA#1580]database_cleanup: Skip studio_customization module skipped for uninstalling * [UPD] Update database_cleanup.pot * database_cleanup 12.0.1.0.1
Syncing from upstream OCA/server-tools (13.0)
Add the option to do the backup without the filestore.
We found ourselves the need for hourly backups.