Ok, got it, the last ID +1 is save automatically by server manager actions in the property MinUid. So adding an ibay manually, one must:
1. Get the value of MinUid to a shell variable e.g. new_id
2. Store a new value to MinUid of new_id + 1
3. Use the variable new_id in the manual create new ibay parameters where Gid is new_id and Uid is new_id
4. signal-event ibay-create
Done. Thanks all.
Well this is when all works good and no rpm has messed up there.
If you check the code you have a loop to test if it is free.
So i suggest you not only assuming the minuid +1 is free and use the function or recreate the same in bash. A search in google will show some.
And conside it not as last uid but minimal uid. Letting lower uid reserved for system. So updating it to get last uid is not the way to do.
Also as you pointed race situation might occurs. And duplicate name if not tested.
So as asked Stefano what is the purpose, as it should need more code around.