On Wed, Apr 13, 2011 at 10:56 PM, Brano Zarnovican zarnovican@gmail.com wrote:
On Wed, Apr 13, 2011 at 10:19 PM, Scott Henson shenson@redhat.com wrote:
On Tue, 12 Apr 2011 18:33:50 +0100, Brano Zarnovican zarnovican@gmail.com wrote:
Hi,
I have a python trigger on post system add hook. Sometimes the change on Cobbler DB made from within the trigger (via API) get lost. I would like to check with you first if I'm allowed to make changes within a trigger, before I open a ticket.
All looks as expected in 'cobbler system report', but the change may not be in the JSON file and it is permanently gone after you do the next cobblerd restart.
I have looked into the issue this week..
The semantic is similar to XML-RPC api. In there, you can change the configuration as much as you like (eg. with modify_system()), but at the end you have to call save_system to make the change permanent (serialize to JSON file). If you don't, it will stay in in-memory copy until the next restart.
In trigger API it's the same story. You can modify the config (system.set_comment), but it won't be serialized automatically. You have to do it explicitly. There is no corresponding save_ method, however. The closest what I found is 'api.serialize()', which saves all objects.
Regards,
BranoZ