Restore app on other machine -> YunohostValidationError "domain_name_unknown"

I tested to restore a backup from one YunoHost machine on a other machine. This will not work, because it seems that the same “domain name” must be registerer on the machine that restores the app:

Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/backup.py", line 1452, in _restore_app
    sync_perm=False,
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 465, in permission_create
    sync_perm=False,
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 531, in permission_url
    url = _validate_and_sanitize_permission_url(url, app_main_path, app)
  File "/usr/lib/moulinette/yunohost/permission.py", line 937, in _validate_and_sanitize_permission_url
    _assert_no_conflicting_apps(domain, path, ignore_app=app)
  File "/usr/lib/moulinette/yunohost/app.py", line 3104, in _assert_no_conflicting_apps
    conflicts = _get_conflicting_apps(domain, path, ignore_app)
  File "/usr/lib/moulinette/yunohost/app.py", line 3080, in _get_conflicting_apps
    raise YunohostValidationError("domain_name_unknown", domain=domain)

That’s boring :wink:

I downloaded the backup file and copied on the destination machine via ssh…

Next try: I just add the “missing” Domain name and start a restore again that failed:

Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/backup.py", line 1452, in _restore_app
    sync_perm=False,
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 412, in permission_create
    raise YunohostValidationError("permission_already_exist", permission=permission)
yunohost.utils.error.YunohostValidationError: Berechtigung 'pyinventory.main' existiert bereits

Note the app was installes before… Then i have uninstall it and then try to restore the backup from the other machine…

Think this is my fail: Have i missed to remove something in pyinventory_ynh/remove at testing · YunoHost-Apps/pyinventory_ynh · GitHub ?!?

You should add the domain to yunohost (even if you don’t have it), the app you want to restore must be uninstalled before proceeding. Yunohost must be up to date. Proceed with the restoration and then change the domain of the app to the new one.

1 Like

Yes, that’s the solution for the domain problem…

The “permission_already_exist” problem still exists. I look around and found similar problems here:

I also tried to remove “pyinventory.main” with:

sudo yunohost user permission remove pyinventory.main

This doesn’t work, too and sudo yunohost user permission list still list “pyinventory.main”

A work-a-round from: No migration ? · Issue #137 · YunoHost-Apps/vaultwarden_ynh · GitHub doesn’t work, too:

jens@rpi:~ $ sudo yunohost tools shell
Warning: The ldap interface is available in this context
Warning: You don't have IPython installed, consider installing it as it is way better than the standard shell.
Warning: Falling back on the standard shell.
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 
KeyboardInterrupt
>>> from yunohost.permission import permission_delete
>>> permission_delete("pyinventory.main")
Traceback (most recent call last):
  File "/usr/lib/moulinette/yunohost/tools.py", line 743, in tools_shell
    from IPython import embed
ModuleNotFoundError: No module named 'IPython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/moulinette/yunohost/log.py", line 380, in func_wrapper
    result = func(*args, **kwargs)
  File "/usr/lib/moulinette/yunohost/permission.py", line 615, in permission_delete
    raise YunohostValidationError("permission_cannot_remove_main")
yunohost.utils.error.YunohostValidationError: Removing a main permission is not allowed
>>> 

EDIT: I run system upgrade… e.g.: Yunohost v4.2.7 → 4.2.8.3 … The i will retry the remove commands…

It seems that upgrade YunoHost fix the problem. With 4.2.8.3 i can restore the app backup :ok_hand:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.