Open kaaage opened 2 years ago
You sure the lower part belogs to that issue?
ERROR 2022-05-03 19:41:42,889 data: Could not find VM file for vm_id vesely15
Traceback (most recent call last):
File "/tira/application/src/./tira/data/data.py", line 73, in _parse_vm_list
vm = Parse(open(vm_dir_path / f"{user.userName}.prototext").read(), modelpb.VirtualMachine())
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/ceph/tira/model/virtual-machines/vesely15.prototext'
[pid: 106|app: 0|req: 2881/25431] 10.23.76.198 () {46 vars in 1955 bytes} [Tue May 3 19:41:42 2022] GET /tira-admin/create-group/ortega22 => generated 85550 bytes in 208 msecs (HTTP/1.1 500) 7 headers in 227 bytes (2 switches on core 0)
@BastianGrahm this is the call made to discourse. Can you check that out?
ret = requests.post("https://www.tira.io/admin/groups",
headers={"Api-Key": self._discourse_api_key(), "Accept": "application/json",
"Content-Type": "multipart/form-data"},
data={"group[name]": f"tira_vm_{vm['vm_id']}", "group[visibility_level]": 2,
"group[members_visibility_level]": 2, "group[bio_raw]": group_bio}
)
return json.loads(ret.text)['basic_group']['id']```
I tested this. This code works and does what it intents but if the group is already existent we get a different answer back
{"errors":["Name has already been taken"]}
and then the error is thrown obviously.
So maybe we should introduce an error check and forward the error message to the user.
I think it would be the best when it just works when the account is already created?
So it continues to create the invite link and the rest of the massage that is shown in the client when the response is {"errors":["Name has already been taken"]}
.
(Because otherwise it gets sometimes complicated to create a new invite)
You sure the lower part belogs to that issue?
ERROR 2022-05-03 19:41:42,889 data: Could not find VM file for vm_id vesely15 Traceback (most recent call last): File "/tira/application/src/./tira/data/data.py", line 73, in _parse_vm_list vm = Parse(open(vm_dir_path / f"{user.userName}.prototext").read(), modelpb.VirtualMachine()) FileNotFoundError: [Errno 2] No such file or directory: '/mnt/ceph/tira/model/virtual-machines/vesely15.prototext' [pid: 106|app: 0|req: 2881/25431] 10.23.76.198 () {46 vars in 1955 bytes} [Tue May 3 19:41:42 2022] GET /tira-admin/create-group/ortega22 => generated 85550 bytes in 208 msecs (HTTP/1.1 500) 7 headers in 227 bytes (2 switches on core 0)
No, not actually.
We'll do Maik's way, this should fix it: https://github.com/tira-io/tira/commit/a7b161078642059ee1bdfc7afd61e50664eb15ef
Has someone tested if this is fixed in live? @kaaage perhaps?
@MattiWe I tested it, yes, the group is created, but the notification that shows up on top is empty and no invitation link is shown.
But this is not a problem with the endpoint I think. The last time I tested it, the response was a 200 and I could extract the invite link etc. from the network tab of the developer tools.
This issue has been marked stale because it has been open 60 days with no activity.
Current behavior ERROR 2022-05-03 19:41:42,844 log: Internal Server Error: /tira-admin/create-group/ortega22 Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/tira/application/src/./tira/checks.py", line 85, in func_wrapper return func(request, *args, *kwargs) File "/tira/application/src/./tira/checks.py", line 180, in func_wrapper return func(request, args, kwargs) File "/tira/application/src/./tira/endpoints/admin_api.py", line 286, in admin_create_group message = auth.create_group(vm) File "/tira/application/src/./tira/authentication.py", line 304, in create_group vm_group = self._create_discourse_group(vm) File "/tira/application/src/./tira/authentication.py", line 286, in _create_discourse_group return json.loads(ret.text)['basic_group']['id'] KeyError: 'basic_group' ERROR 2022-05-03 19:41:42,889 data: Could not find VM file for vm_id vesely15 Traceback (most recent call last): File "/tira/application/src/./tira/data/data.py", line 73, in _parse_vm_list vm = Parse(open(vm_dir_path / f"{user.userName}.prototext").read(), modelpb.VirtualMachine()) FileNotFoundError: [Errno 2] No such file or directory: '/mnt/ceph/tira/model/virtual-machines/vesely15.prototext' [pid: 106|app: 0|req: 2881/25431] 10.23.76.198 () {46 vars in 1955 bytes} [Tue May 3 19:41:42 2022] GET /tira-admin/create-group/ortega22 => generated 85550 bytes in 208 msecs (HTTP/1.1 500) 7 headers in 227 bytes (2 switches on core 0)
Expected behavior