auto_backup icon indicating copy to clipboard operation
auto_backup copied to clipboard

14.0 Error when try to run scheduler

Open mncoon opened this issue 2 years ago • 9 comments

Hi!

In V14 when try to run the scheduler the following error is thrown:

Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/14.0/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 685, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 361, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/14.0/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 914, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 533, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/14.0/odoo/addons/web/controllers/main.py", line 1398, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/14.0/odoo/addons/web/controllers/main.py", line 1386, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/14.0/odoo/odoo/api.py", line 399, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/14.0/odoo/odoo/api.py", line 386, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/14.0/odoo/odoo/addons/base/models/ir_cron.py", line 83, in method_direct_trigger
    cron.with_user(cron.user_id).with_context(lastcall=cron.lastcall).ir_actions_server_id.run()
  File "/opt/odoo/14.0/odoo/odoo/addons/base/models/ir_actions.py", line 632, in run
    res = runner(run_self, eval_context=eval_context)
  File "/opt/odoo/14.0/odoo/addons/website/models/ir_actions.py", line 61, in _run_action_code_multi
    res = super(ServerAction, self)._run_action_code_multi(eval_context)
  File "/opt/odoo/14.0/odoo/odoo/addons/base/models/ir_actions.py", line 501, in _run_action_code_multi
    safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True)  # nocopy allows to return 'action'
  File "/opt/odoo/14.0/odoo/odoo/tools/safe_eval.py", line 346, in safe_eval
    raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 641, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/14.0/odoo/odoo/http.py", line 317, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: <class 'FileNotFoundError'>: "2
No such file or directory" while evaluating
'model.schedule_backup()'

It sounds to me like missing the local folder where the backup should go. But it is all setted up well with write permissions and the correct user role.

Here is a screenshot of the config: image

Can you please guide me a little bit what the error exactly means? Tahnk you very much.

mncoon avatar Apr 20 '22 06:04 mncoon

@mncoon hmm, that is odd. Are you sure the exact path /opt/odoo/14.0/backup does exist and that it is accessible for the Odoo user? 🤔

Yenthe666 avatar Apr 20 '22 08:04 Yenthe666

@Yenthe666 thanks for your reply and yes, it exists:

image

mncoon avatar Apr 20 '22 08:04 mncoon

I honestly don't see anything off in your config right away. The only way to find this one would be to add prints in the Python file and see where it fails 🤔

Yenthe666 avatar Apr 20 '22 09:04 Yenthe666

@Yenthe666 : We were concerned with this issue aswell.

It turns out (@mncoon found the problem and the solution), the reason for the problem was: The name of the Odoo-Backup-Object is used as part of the filename of the backup-file. If this name contains any characters (or combination of characters), which result in an error of the OS trying to create that filenode, the backup will fail.

Maybe you can do one of the two following things:

  • add a check on update of the Odoo-Object, whether the filename is valid (means: a filesystemnode can be created with this name), or
  • document, that the Odoo-Objects name will be part of the name of the backup file and thus has to be compliant with the OS used.

Thank you very much!

mraenker avatar May 09 '22 10:05 mraenker

@mraenker and @mncoon thanks for digging further into that and letting me know :) Do you have a sample case documented which failed for you? 🤔

Yenthe666 avatar May 09 '22 13:05 Yenthe666

@Yenthe666 if you are using something like "sftp:[email protected]/folder1/folder2" as name 😭.

mncoon avatar May 09 '22 13:05 mncoon

Sometimes you get ideas that you can't really come up with...

mncoon avatar May 09 '22 13:05 mncoon

Hey, I encounter the same issue and @mncoon can you let me know in detail how you solved it?

gexiaut avatar Jun 23 '22 14:06 gexiaut

@gexiaut yes, If you have the folder structure in the name of the configuration the problem comes up. Please try to name the name of the config not with / or @.

mncoon avatar Jun 23 '22 14:06 mncoon