can't delete afanasy user with afcmd udel command

Customize rules.
Post Reply
c.r.m
Posts: 4
Joined: Tue Jul 23, 2019 5:38 am

can't delete afanasy user with afcmd udel command

Post 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."}}
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post 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).
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
c.r.m
Posts: 4
Joined: Tue Jul 23, 2019 5:38 am

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

Post 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"
 }
}
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post 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.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
c.r.m
Posts: 4
Joined: Tue Jul 23, 2019 5:38 am

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

Post by c.r.m »

Thank you a lot. All is clear now.
Post Reply