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

Handled exception: ValueError: Internal group has more than one project assigned! #7503

Closed
2 tasks done
burner1024 opened this issue Apr 16, 2022 · 14 comments
Closed
2 tasks done
Labels
question This is more a question for the support than an issue. wontfix Nobody will work on this.

Comments

@burner1024
Copy link
Contributor

burner1024 commented Apr 16, 2022

Describe the issue

Trying upgrade to 4.11.2.
Turns out, I have a group which has no projects assigned. Migrations fail, container doesn't start.
No option to delete the group in UI. Don't see a management command for it, either.

Migration checks for exactly one group, but error message says "more than one".

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

Standard docker-compose up with new version.

Expected behavior

  1. Upgrade not failing when a group has no projects assigned.
  2. Some option to delete the group.
  3. Less misleading error message.

Screenshots

Screenshots are from previous 4.9 version.

Captura de pantalla de 2022-04-16 18-02-38

Captura de pantalla de 2022-04-16 17-51-45

Exception traceback

[2022-04-16 10:34:13,918: WARNING/45] Handled exception: ValueError: Internal group Dangerous Quest!@Administration has more than one project assigned!
Traceback (most recent call last):
  File "/usr/local/bin/weblate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/weblate/runner.py", line 34, in main
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 98, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 290, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 131, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 163, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 248, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/migration.py", line 131, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/usr/local/lib/python3.10/site-packages/weblate/auth/migrations/0021_migrate_internal_groups.py", line 18, in migrate_internal_groups
    raise ValueError(
ValueError: Internal group Dangerous Quest!@Administration has more than one project assigned!
  Applying weblate_auth.0021_migrate_internal_groups...

How do you run Weblate?

Docker container

Weblate versions

Standard 4.11.2-1 Docker.

Weblate deploy checks

Probably not relevant, but if needed, can add.

Additional context

No response

@nijel
Copy link
Member

nijel commented Apr 20, 2022

You've probably made some modifications to Weblate internal groups, and the migration does not deal with that. Please fix the project assignment for the Dangerous Quest!@Administration group manually before doing the migration.

@nijel
Copy link
Member

nijel commented Apr 20, 2022

See also WeblateOrg/docker#1454

@nijel nijel added the question This is more a question for the support than an issue. label Apr 20, 2022
@github-actions
Copy link

This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger.

In case your question is already answered, making a donation is the right way to say thank you!

@burner1024
Copy link
Contributor Author

burner1024 commented Apr 20, 2022

You've probably made some modifications to Weblate internal groups, and the migration does not deal with that. Please fix the project assignment for the Dangerous Quest!@administration group manually before doing the migration.

I'm fairly sure I didn't. But anyway, how do I fix it?
In fact, I don't want to fix it. I want to delete the group. I don't see a way. There's no option to change or delete anything in the interface.

@github-actions
Copy link

github-actions bot commented May 1, 2022

This issue has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!

@github-actions github-actions bot added the wontfix Nobody will work on this. label May 1, 2022
@burner1024
Copy link
Contributor Author

I still think there's at least 3 issues here.

@github-actions github-actions bot removed the wontfix Nobody will work on this. label May 2, 2022
@nijel
Copy link
Member

nijel commented May 10, 2022

In case you are not using it to grant access at project level, the easiest solution is to remove it. `weblate shell -c 'from weblate.auth.models import Group; Group.objects.get(name="Dangerous Quest!@administration").delete()'

If you are using it, run the interactive shell and fix the projects assignment:

from weblate.auth.models import Group; 
group = Group.objects.get(name="Dangerous Quest!@Administration")
print(group.projects)
# Remove unwanted one
group.projects.remove(group.projects[0])

@burner1024
Copy link
Contributor Author

Thank you.
I was able to delete the group using API, then upgrade.
It is strange that UI doesn't allow to do that.

@github-actions
Copy link

This issue has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!

@github-actions github-actions bot added the wontfix Nobody will work on this. label May 21, 2022
@Vadsher
Copy link

Vadsher commented Dec 20, 2022

I faced with the same issue when updating Weblate from 4.10.1-1 to 4.11.2-1. Weblate runs in Docker container. Updated using pull and deploy new image
As mentioned above there is no option to delete the group in UI. I tried to fix the projects assignment:

weblate@c7da50344aa7:/$ weblate shell -c 'from weblate.auth.models import Group; group = Group.objects.get(name="web_app_v2@Translations_All"); print(group.projects)'
trans.Project.None

But there are only one entry and I couldn't find any mention about "trans.Project.None" in any my projects (also we have only two projects).
Maybe someone can give a good idea where to find the solution or knows how to solve it. Thank you

@burner1024
Copy link
Contributor Author

So you want to delete or fix?
API should work for deletion.

@Vadsher
Copy link

Vadsher commented Dec 21, 2022

First of all, thank you for responding.

  1. I would like to understand what "trans.Project.None" is.
  2. We have only 2 projects, one is inactive, but we can't delete it.
  3. "web_app_v2@Translations_All" internal group is used in our active project and I don't want to damage anything in any way.

Therefore:

  1. The ideal option is to fix it. As far as I understand, we need to remove the binding to the first inactive project.
  2. If I delete something, I want to understand what it is.

If you need any more information, please let me know.
P.S. Weblate is very interesting program, I encountered it for the first time, I am still figuring it out.

@burner1024
Copy link
Contributor Author

I think your error says that no projects are assigned.
Although I'm not sure how Translations_All came to be an internal group in the first place, did you rename Administration or something?

From my experience, it's best to stay away from internal groups. With Weblate's limitations and quirks, they are less than useless. Just define your own and grant permission through those.

@Vadsher
Copy link

Vadsher commented Dec 21, 2022

I forgot to say that I originally updated the image from 4.8-1 to 4.10.1-1, the migration of the database was successful.

I definitely did not rename the group, maybe someone before me. But the group "web_app_v2@Administration" is present. In the history of the group "web_app_v2@Translations_All" I found a record that it was added through the Weblate administration portal.

I think your error says that no projects are assigned

I thought so too.

In that case, what's the best thing to do first:

  • try adding to the active project? But I have to mention, UI changes are not available, and through API or shell I still can't figure out how to do it correctly.
  • is it possible to remove the property of the internal group? What can it lead to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is more a question for the support than an issue. wontfix Nobody will work on this.
Projects
None yet
Development

No branches or pull requests

3 participants