Page 1 of 1

can't delete afanasy user with afcmd udel command

Posted: Tue Jul 23, 2019 5:46 am
by c.r.m
I created a new user. When I want to delete this user again the message shows "Action processed." but the user wasn't removed. Has this something to do with permissions or do I have to create a new ubuntu user with same name to be able to delete afanasy users?

Code: Select all

$ afcmd uadd newuser
Config file does not exist:
/opt/cgru/config.json
{"user":
{
"name":"newuser",
"id":5,
"priority":99,
"solve_method":"solve_order",
"solve_need":"solve_capacity",
"time_register":1563859411,
"time_activity":1563859411,
"errors_retries":3,
"errors_avoid_host":3,
"errors_task_same_host":3,
"errors_forgive_time":18000
}
}

Code: Select all

$ afcmd udel newuser
Config file does not exist:
/opt/cgru/config.json
{"info":{"kind":"log","text":"Action processed."}}

Re: can't delete afanasy user with afcmd udel command

Posted: Tue Jul 23, 2019 10:18 am
by timurhai
Hi.
Just now have repeated the same situation.
It seems that there is a bug.
I was able do delete user from afwatch.
Strange, but it uses the same JSON protocol (API).
So, probably that the bug is in afcmd.
I will look at it.

btw,
You can use JSON protocol directly w/o CLI (afcmd) or GUI (afwatch\WEB).

Re: can't delete afanasy user with afcmd udel command

Posted: Thu Jul 25, 2019 9:25 am
by c.r.m
btw,
You can use JSON protocol directly w/o CLI (afcmd) or GUI (afwatch\WEB).
How to use json protocol directly?

Would this be correct json call?

Code: Select all

{
 "delete":
 {
  "type" : "users",
  "name" : "username"
 }
}

Re: can't delete afanasy user with afcmd udel command

Posted: Mon Jul 29, 2019 2:24 pm
by timurhai
Hi.
Bug was fixed:
https://github.com/CGRU/cgru/commit/2d8 ... 23cd0ce7dc

Later afcmd udel set permanent to false. User became temporal. Server deletes temporal users with no jobs.
This was long ago, now there are no permanent/temporal users (server does not delete users no more in any case).

If you want to see JSON data that afcmd sends, apply this commit:
https://github.com/CGRU/cgru/commit/151 ... d65a6347ee

It will be something like:

Code: Select all

{"action":{
"user_name":"timurhai",
"host_name":"hotgirl",
"type":"users",
"mask":"_test_",
"operation":{
"type":"delete"
}
}}
Also you can run afwatch in a console (on Linux only), perform some action and see data it sends to server.

Re: can't delete afanasy user with afcmd udel command

Posted: Thu Aug 01, 2019 6:07 pm
by c.r.m
Thank you a lot. All is clear now.