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

Update db_backup.py to Fix Deprecation Warning in 16.0 & 17.0 and fixed Warning/Error Messages #266

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

Sn0w3y
Copy link

@Sn0w3y Sn0w3y commented Feb 20, 2024

2024-02-20 23:00:00,529 2816741 WARNING goodpi py.warnings: /opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py:315: DeprecationWarning: Since 16.0, use subprocess directly.
File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/odoo16/odoo16/odoo/service/server.py", line 497, in target
self.cron_thread(i)
File "/opt/odoo16/odoo16/odoo/service/server.py", line 478, in cron_thread
ir_cron._process_jobs(db_name)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 122, in _process_jobs
registry[cls._name]._process_job(db, cron_cr, job)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 331, in _process_job
ir_cron._callback(job['cron_name'], job['ir_actions_server_id'], job['id'])
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 374, in _callback
self.env['ir.actions.server'].browse(server_action_id).run()
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 674, in run
res = runner(run_self, eval_context=eval_context)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 544, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self)) # nocopy allows to return 'action'
File "/opt/odoo16/odoo16/odoo/tools/safe_eval.py", line 362, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(347,)", line 1, in
File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 148, in schedule_backup
self._take_dump(rec.name, fp, 'db.backup', rec.backup_type)
File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 315, in _take_dump
odoo.tools.exec_pg_command(*cmd)

2024-02-20 23:00:00,529 2816741 WARNING goodpi py.warnings: /opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py:315: DeprecationWarning: Since 16.0, use `subprocess` directly.
  File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/odoo16/odoo16/odoo/service/server.py", line 497, in target
    self.cron_thread(i)
  File "/opt/odoo16/odoo16/odoo/service/server.py", line 478, in cron_thread
    ir_cron._process_jobs(db_name)
  File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 122, in _process_jobs
    registry[cls._name]._process_job(db, cron_cr, job)
  File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 331, in _process_job
    ir_cron._callback(job['cron_name'], job['ir_actions_server_id'], job['id'])
  File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 374, in _callback
    self.env['ir.actions.server'].browse(server_action_id).run()
  File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 674, in run
    res = runner(run_self, eval_context=eval_context)
  File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 544, in _run_action_code_multi
    safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self))  # nocopy allows to return 'action'
  File "/opt/odoo16/odoo16/odoo/tools/safe_eval.py", line 362, in safe_eval
    return unsafe_eval(c, globals_dict, locals_dict)
  File "ir.actions.server(347,)", line 1, in <module>
  File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 148, in schedule_backup
    self._take_dump(rec.name, fp, 'db.backup', rec.backup_type)
  File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 315, in _take_dump
    odoo.tools.exec_pg_command(*cmd)
@Sn0w3y
Copy link
Author

Sn0w3y commented Mar 9, 2024

up

@Sn0w3y Sn0w3y changed the title Update db_backup.py to Fix Deprecation Warning in 16.0 and fixed Warning/Error Messages Update db_backup.py to Fix Deprecation Warning in 16.0 & 17.0 and fixed Warning/Error Messages Mar 9, 2024
@@ -88,30 +88,47 @@ def test_sftp_connection(self, context=None):
username_login = rec.sftp_user
password_login = rec.sftp_password

# Connect with external server over SFTP, so we know sure that everything works.
s = paramiko.SSHClient()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be outside the try - except block

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

Successfully merging this pull request may close these issues.

1 participant